Hi all,
I’m trying to set up logging from a Jruby (1.3.1) on Rails (2.3.4)
application running on top of Tomcat 5.5. I have two problems that I’ve
been searching around for and can’t seem to find great solutions to.
-
I’m getting exclamation points in catalina.out (one per line) which
are
clearly coming from the Rails application during both war deployment and
while the app is running. Has anyone seen this and know of a solution?
-
I have a context block set up in my server.xml for the rails app with
a
logger configured inside of that. This doesn’t seem to do anything. I
know
that I can configure the log location from within the environment of the
rails application using Logger.new, but that doesn’t seem like the
appropriate way to specify the log location since it will be system
dependent. Is there any way to get jruby/rails to play nice with the
tomcat
logging settings? If so, how could I go about this?
Thanks in advance!
tony
The best thing I found was just separate the log file for the rails war
file
in the logging.properties config like this.
handlers = 1catalina.org.apache.juli.FileHandler, *
5myapp.org.apache.juli.FileHandl**er*,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler,
4admin.org.apache.juli.FileHandler,
5host-manager.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
5myapp.org.apache.juli.FileHandler.level = FINE
5myapp.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5myapp.org.apache.juli.FileHandler.prefix = insider.
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp].level
= INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp].handlers
= 5insider.org.apache.juli.FileHandler
~Matt
Matt,
Thanks for the quick response. I’m probably doing something wrong here,
but
I tried that and that log file remains empty. Is there some other
setting
in rails I need to set for the log file to end up there? I’ve tried
pointing it to STDOUT (which just makes everything show up in
catalina.out)
as well as leaving everything as the default. I’m probably missing
something simple here. Thanks again!
tony
I wanted this app to run from the root and so I have a context entry for
it
like so in my main host block in server.xml:
mydomain.com
The app lives in webapps/myapp. I’ve then got all the logging
properties
set like so:
handlers = … more entries …, 6myapp.org.apache.juli.FileHandler,
…
more entries …
6myapp.org.apache.juli.FileHandler.level = INFO
6myapp.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
6myapp.org.apache.juli.FileHandler.prefix = myapp.
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp].level
= INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp].handlers
= 6myap**p.org.apache.juli.FileHandler
Is there some name value I need to set for the context entry for it to
be
picked up in the logging.properties? Also, any thoughts on the
exclamation
point issue? They seem to end up in catalina.out no matter where rails
is
logging and seem to be independent of it. Thanks again!
tony
Yeah you use STDOUT, if you see it in your catalina.out your almost
there.
You need to make sure your logging properties is mapped to the same
context
name as your rails app
ie. localhost:8080/*mattscoolapp *
~Matt
Not sure if this will be useful to anyone but I just couldn’t get the
Tomcat
properties to work. I ended up going the route described here:
Ronin on Rails: Auto-rotate Rails log files.
Not ideal since I don’t have external configuration now, but it is much
simpler and just works for me at the moment. I still haven’t figured
out
the reason why there are tons of exclamation points getting sent to
STDOUT
and ending up in the Tomcat log. Anyway, hope this might help someone
in
the future struggling with the same thing.
tony