You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rob Levin <li...@yahoo.com> on 2008/02/01 18:45:42 UTC
Trouble Setting Log Levels lower than INFO with Tomcat 6 JULI on Linux toshiba 2.6.22-14-generic i686 GNU/Linux Kubuntu Gutsy
Hi all, and thanks for reviewing my posting. I'm trying to use JULI with the java.util.logging and don't want to have to switch to log4j if at all possible. Here's my issue:
I have custom log file being created by putting a logging.properties file in my apps
WEB-INF/classes per the tomcat logging reference docs. I get the
custom logs that look like so: myPrefix2008-01-31.log. However, when I
try to lower the levels of logging I can't seem to get it below
Level.INFO logging.
I haven't checked my jdk logging properties because that would defeat
the whole purpose of being able to use log levels dynamically via
Tomcat's JULI implementation that are supposed to set levels independent of underlying jdk log settings per the Tomcat 6 online manual, Logging section. I'd like to be able to do this dynamically so that all my users can set log levels via logging.properties in my app's WEB-INF/classes dir as opposed to having to find their jdk logging properties. I've even tried deleting the my app's logging.properties and putting everything in the tomcat/conf/logging.properties. Didn't help. Even tried setting every entry to ALL or FINEST! No change. I've read the documentation and tried the archives - I'm probably missing something obvious on how this works so I apologize for my ignorance but I could really use a hint ;)
Here's an example of my latest stab at logging.properties files and the results:
tomcat/conf/logging.properties:
handlers = org.apache.juli.FileHandler,
1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
..handlers = org.apache.juli.FileHandler,
1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.FileHandler.level = ALL
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/
logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = ALL
2localhost.org.apache.juli.FileHandler.directory = $
{catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
org.apache.catalina.core.ContainerBase.[Catalina].
[localhost].level = ALL
org.apache.catalina.core.ContainerBase.[Catalina].
[localhost].handlers = 2localhost.org.apache.juli.FileHandler
--------
Here's the logging.properties I have in myapp's /WEB-INF/classes:
--------
handlers = org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
org.apache.juli.FileHandler.level=ALL
org.apache.juli.FileHandler.directory=${catalina.base}/logs
org.apache.juli.FileHandler.prefix=dispatch
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
When I try these lines of code in my JSP:
logger.logp(Level.CONFIG,"configureApplication.jsp","POST",
"******* test CONFIG");
logger.logp(Level.INFO,"configureApplication.jsp",
"POST","******* test INFO");
logger.logp(Level.FINE,"configureApplication.jsp",
"POST","******* test FINE");
logger.logp(Level.FINER,"configureApplication.jsp",
"POST","******* test FINER");
When I run and check my log file, only the Level.INFO message gets logged! Any
suggestions? Thanks for your patience (and hopefully) help with this matter.
A Java Programmer who loves Linux - linjava@yahoo.com
---------------------------------
Never miss a thing. Make Yahoo your homepage.