On Mon, 12 Sep 2005 09:05:18 -0500, Jacob Kjome wrote: > Quoting Michael A Chase <[EMAIL PROTECTED]>:
>> Can anyone point me to some way to capture the logging done via >> (ServletContext).log() so everything can go through log4j? >> > Grab the LOG4J_SANDBOX_ALPHA3 tag of the logging-log4j-sandbox and build > yourself to get the ServletContextLogAppender, compatible with > Log4j-1.2.xx (HEAD compatible with Log4j-1.3... to the best of my > recollection). > > http://cvs.apache.org/viewcvs.cgi/logging-log4j-sandbox/src/java/org/apache/log4j/servlet/ServletContextLogAppender.java?rev=1.6&view=log > > Note that this doesn't always seem to work well (or at all) in an > environment that does parent-first classloading and/or log4j.jar isn't > stored in each individual webapp along with parent-last classloading > (such as Tomcat). So, if you deploy log4j-sandbox.jar and log4j.jar in > each webapp's WEB-INF/lib along with parent-last classloading, this > should work pretty well for you. Make sure to test this yourself before > assuming it will work in your environment. Consider this the reason why > it is still in the sandbox rather than log4j proper. Thank you for the pointer to the sandbox. It provided useful concepts for managing logging levels dynamically and we have been pleased with the results. If I understand the comments and code in these Java files, this is the reverse of what I'm trying to do; it allows log4j to send its messages to the servlet context's log instead of managing its own output. One of the most interesting features of log4j for us is the ability to rotate logs automatically, so I hope to cause messages from the servlet context logger to go through log4j instead of the other way around. -- Mac :}) Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
