-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Beeky,
On 3/27/2009 1:41 PM, beeky wrote: > Christopher, > Thanks for the reply, unfortunately I did not understand much of it. Can I > ask some questions about what you said? Absolutely. >> log4j.rootLogger=ERROR, stdout, TOMCAT >> This should only allow ERROR or higher messages to be logged, unless >> another logger has explicitly set a lower log level to be logged (and >> that logger is being used). That does not appear to be the case, here. > > Are you saying the line should be: > log4j.rootLogger=ERROR No, the rootLogger line indicates the default log level (that's the "ERORR" part) plus the default appenders (that's the "stdout,TOMCAT" part). You don't want to change either of these. In log4j, a logger is a named entity that you can send log messages to. An appender is something that actually writes to a destination such as a file, database, console, etc. The combination of logger + appender allows you to create very nuanced configurations. >> log4j.rootCategory=debug, OBIS >> This is likely to be the source of the problem: you have defined the >> root logger (rootCategory is deprecated in favor of rootLogger) to have >> a log level of DEBUG. This will affect any log messages emitted by your >> application. > > I want my application to emit debug messages. Is there a way to do this > that does not involve setting the category to DEBUG? Not really. I suppose you could set the rootLogger to ERROR and then override this for your own classes. Something like this: log4j.rootLogger=ERROR, OBIS ... log4j.appender.OBIS.threshold=DEBUG ... log4j.logger.your.package.goes.here=DEBUG This should block messages lower than ERROR for all loggers except those under the "your.package.goes.here" package, which will log at the DEBUG level. If you have "com.mycompany" as the prefix for all your loggers (which are usually named after your class names), then you can simply do this: log4j.logger.com.mycompany=DEBUG See this page for tons of information: http://logging.apache.org/log4j/1.2/manual.html. You can skip all the code examples and look at the log4j.properties examples. >> SmapUtil is in the org.apache.jasper.compiler package, so you need to >> add configuration for that. It looks like you already have one: >> log4j.logger.org.apache.jasper.compiler=ERROR > > This is the basic problem, this does not stop jasper logging. Does the fact > that Jasper is logging to the application log file indicate that this line > should be something different? I'm not entirely sure. Your configuration looks good as long as your config file is really called log4j.properties. Do you include log4j.jar in your web application's WEB-INF/lib directory? Do you manually load the log4j.properties file anywhere in your code? I'm a little unclear as to how Tomcat works when log4j is being used both for the container as well as for the webapp. Try updating your configuration to add another appender, just to test to see that your configuration is actually being read: log4j.rootLogger=ERROR, testing log4j.appender.testing=org.apache.log4j.FileAppender log4j.appender.testing.File=C:/Program Files/Apache Software Foundation/apache-tomcat-5.5.27/webapps/OBIS1.2/OBISLog/test.log Then restart the entire Tomcat (not just your webapp, just in case). If the test.log file appears in the appropriate directory, then log4j /is/ loading your configuration from the file you think it is. If that log file is not created, then we need to look at some other options. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAknNJxcACgkQ9CaO5/Lv0PBDCACcD0xL4aHrxvK3qxrlZKT0GO2B WlYAoL0o0HKTzEwSFSw6MMzQTDoGj19A =LNEm -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org