Many thanks for the response. For some reasons I did not see it over the (hot and humid) weekend.
yes - I did those steps and it does work well ... although in my case I cannot use TC_HOME (read-only) for the log4j.properties (and log4j.jar) - I need it in TC_BASE so it can be customized. In either case, the challenge I have is that if I add to my hello.jsp the line: <% log( "this is a log message" ); %> The message is logged in the (common) tomcat logfile and not in the webapp's logfile defined in its WEB-INF/classes/log4j.properties. So I must not be understanding some concept here :-( Rgds - Fred Filip Hanik - Dev Lists wrote: > > for tomcat container logging, its easy > > 1. put log4j.jar in TC_HOME/lib > 2. put log4j.properties in TC_HOME/lib > 3. compile the extras > ant -f extras.xml > 4. replace TC_HOME/bin/tomcat-juli.jar with the one compiled from step 3 > 5. put extras/..../tomcat-juli-adapters.jar in TC_HOME/lib > > and that's it, no need to mess with anything else > > and for webapp logging, that was described earlier > > Filip > > fredk2 wrote: >> I would like both.... one <common>/lib/log4j.properties for the main >> Tomcat >> container logging and another log4j for each web apps - where you set its >> log filename and rotation etc... >> >> The tomcat logging would be of interest to an admin and the web app logs >> to >> the developer. >> >> Do I make sense? >> >> Tx - Fred >> >> >> Filip Hanik - Dev Lists wrote: >> >>> if you want to use log4j in your application only, >>> then forget everything you read on logging.html >>> >>> all you need to do is log4j.jar in WEB-INF/lib >>> log4j.properties in WEB-INF/classes >>> >>> the steps you are outlining, are converting tomcat from using >>> java.util.logging to log4j for the container. and you don't need those >>> steps if all you want is log4j for a webapp >>> >>> Filip >>> >>> fredk2 wrote: >>> >>>> Hi, >>>> >>>> still reading :-) http://tomcat.apache.org/tomcat-6.0-doc/logging.html >>>> >>>> I have setup log4j as above, but with a little twist. >>>> If you permission $CATALINA_HOME as read only and you want to customize >>>> the >>>> log4j.properties then you need to install the log4j1.2.14.jar and >>>> log4j.properties in $CATALINA_BASE/lib. >>>> You also need to adjust the catalina.properties common.loader >>>> >>>> common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar >>>> >>>> The tomcat logging works well. However, I have 2 questions related to >>>> installing log4j for a web application: >>>> >>>> 1. why does the documentation say to add log4j1.2.x.jar to the >>>> WEB-INF/lib, >>>> isn't it already loaded by the common.loader at this point? >>>> >>>> 2. is there a way to add a WEB-INF/classes/log4j.properties to log to >>>> myapp1.log and capture all the logs related to the web application ? >>>> Why >>>> would'nt the following create a myapp1.log? >>>> >>>> <myapp1>/WEB-INF/classes/log4j.properties -> >>>> >>>> log4j.debug=TRUE >>>> log4j.rootLogger=DEBUG,myapp1 >>>> >>>> # test logger >>>> log4j.logger.org.apache=DEBUG,myapp1 >>>> >>>> # Log rotation >>>> log4j.appender.myapp1=org.apache.log4j.DailyRollingFileAppender >>>> log4j.appender.myapp1.File=${catalina.base}/logs/myapp1.log >>>> log4j.appender.myapp1.DatePattern='.'yyyy-MM-dd >>>> # Print the date in ISO 8601 format >>>> log4j.appender.myapp1.layout=org.apache.log4j.PatternLayout >>>> log4j.appender.myapp1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n >>>> >>>> >>>> Any hints - suggestions are appreciated, >>>> Many Thanks - Fred >>>> >>>> >>> --------------------------------------------------------------------- >>> To start a new topic, e-mail: users@tomcat.apache.org >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> >> > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Tomcat-6-and-log4j-for-a-web-application-tf4325752.html#a12348344 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]