How to control WebApp logging by Tomcat control files

Being new to WebApps, I started with TOMCAT 7 and try to do Logging with LOGBACK. I'm doing this already on WebApp Basis by adding all necessary resources to the WebApp Environment (WEB-INF). Here I'm using the ConsoleAppender and all messages are captured then by the default java.util.logging and stored to a file (just TOMCAT 7 default configuration). I found the explanation to replace java.util.logging by logback (http://logback.qos.ch/access.html) and got it running. But don't understand how it works. 1. I tried the sample configuration "Example 2: RollingFileAppender" but am still wondering where it's stored. Though the StatusMessageServlet displays some messages, I can't figure out from where they are retrieved. Only specifying <file>${catalina.base}/logs/access.log</file> directed the file to a known location. 2. The access.log was not zipped as indicated by the definition "<fileNamePattern>/access.%d{yyyy-MM-dd}.log.zip</fileNamePattern>" nor did it contain the messages displayed by the StatusMessageServlet 3. I've no clue how to control the WebApp logging by the central configuration file. I would prefer controlling logging be central config files rather than be files maintained by the WebApp itself. How can I manage to connect my WebApp to the central logback.xml I hope the questions make any sense. I'm lacking some fundamental understanding with logging by Tomcat. -- View this message in context: http://logback.10977.n7.nabble.com/How-to-control-WebApp-logging-by-Tomcat-c... Sent from the Users mailing list archive at Nabble.com.

Until now I learned that LOGBACK can replace java.util.logging only for access logging until. It seems, only log4j can provide a full java.util.logging replacement. As LOGBACK can't replace JUL, I can't use LOGBACK to control WebApplicationLogging centrally, though I'm no longer sure that this might be a good idea, anyway. I learned to control the access log now, so I'm done with my question. -- View this message in context: http://logback.10977.n7.nabble.com/How-to-control-WebApp-logging-by-Tomcat-c... Sent from the Users mailing list archive at Nabble.com.

ulrich, you may want to checkout these pages https://github.com/grgrzybek/tomcat-slf4j-logback (an example implementation of using logback with tomcat for all logging) http://www.slf4j.org/legacy.html (some overview of how to use slf4j to support legacy logging interfaces) in short logback and slf4j can replace anything you might be using log4j for if you are using logback for access logging under tomcat you may also want to add the Remote IP Valve to your tomcat configuration if you are running behind a load balancer that provides X-Forwarded-For headers ________________________________________ From: Logback-user <logback-user-bounces@qos.ch> on behalf of Ulrich <Forums@gombers.de> Sent: Monday, April 21, 2014 00:04 To: logback-user@qos.ch Subject: Re: [logback-user] How to control WebApp logging by Tomcat control files Until now I learned that LOGBACK can replace java.util.logging only for access logging until. It seems, only log4j can provide a full java.util.logging replacement. As LOGBACK can't replace JUL, I can't use LOGBACK to control WebApplicationLogging centrally, though I'm no longer sure that this might be a good idea, anyway. I learned to control the access log now, so I'm done with my question. -- View this message in context: http://logback.10977.n7.nabble.com/How-to-control-WebApp-logging-by-Tomcat-c... Sent from the Users mailing list archive at Nabble.com. _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
participants (2)
-
Boogie Shafer
-
Ulrich