RajeshS
RajeshS

Reputation: 170

Configuring tomcat for internal log with log4j!

I am using apache-tomcat-6.0.18 and want to configure log4j for tomcat internal logging.

I gone through the tomcat site Logging in Tomcat. But i didn't understood the STEP 3,4,5.

What is the extras components? How can these be helpful for Logging?

If someone can guide me Step By Step will really help !!!

Please guide me on this?

Upvotes: 3

Views: 4766

Answers (2)

RajeshS
RajeshS

Reputation: 170

@Thanks DaveRead, I got my problem resolved, I just made some changes in log4j.properties file and its working. Here is entry.

....
....

#Roll-over the log once per day
log4j.appender.CATALINA.DatePattern='.'yyyy-MM-dd'.log' log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n log4j.appender.CATALINA.layout=org.apache.log4j.PatternLayout
log4j.appender.CATALINA.append=true

log4j.appender.LOCALHOST=org.apache.log4j.DailyRollingFileAppender log4j.appender.LOCALHOST.file=${catalina.base}/logs/localhost.log log4j.appender.LOCALHOST.encoding=UTF-8
#Roll-over the log once per day log4j.appender.LOCALHOST.DatePattern='.'yyyy-MM-dd'.log' log4j.appender.LOCALHOST.layout.ConversionPattern = %d [%t] %-5p %c- %m%n log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout log4j.appender.LOCALHOST.append=true
...
...

Upvotes: 0

DaveRead
DaveRead

Reputation: 3413

If you don't need to build Tomcat from source then get the tomcat-juli.jar and tomcat-juli-adapters.jar from this location: http://mirrors.enquira.co.uk/apache/tomcat/tomcat-6/v6.0.32/bin/extras/

and replace the .jar files as per the instructions.

$CATALINA_HOME is where your Tomcat 6.0 is installed.

Hope this helps.

Upvotes: 1

Related Questions