[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
log4j usage  XML
Forum Index -> Development
Author Message
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...just had a call with a user who had the problem to get log4j to work inside the Tomcat environment. Well, the problem was solved in the meantime - so I publish what was done in this forum:

Symtom:

The following messages appear when starting Tomcat:
log4j:WARN No appenders could be found for logger (com.sun.faces.config.ConfigureListener).
log4j:WARN Please initialize the log4j system properly.

...and log4j was in general not properly working within the webapp.

Solution: add the following log4j.properties file to /tomcat/lib/ (<== or the corresponding directory in Tomcat5 versions):

Code:
 log4j.rootLogger=info, R 
 log4j.appender.R=org.apache.log4j.RollingFileAppender 
 log4j.appender.R.File=${catalina.home}/logs/tomcat.log 
 log4j.appender.R.MaxFileSize=10MB 
 log4j.appender.R.MaxBackupIndex=10 
 log4j.appender.R.layout=org.apache.log4j.PatternLayout 
 log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n 
 log4j.logger.org.apache.catalina=DEBUG, R
 


Maybe other log4j users have somme additional experience: please add to this post... Thanks!

Björn

PS: I have to add: CaptainCasa is internally using the default logging coming with Java, so I am not the log4j expert...

Björn Müller, CaptainCasa GmbH
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hello Forum,

do have any hints using log4j in Enterprise Client environment?
There are discussions (other forums) using a common log4j.jar (tomcat/lib) or deplying an own one.

I get the same error message. Is it right to copy a log4j.property file into tomcat/lib? In my opinion the right place for log4j.property is inside the classpath (WEB-INF/classes)

I prefer to use a single instance of log4j.jar inside tomca/lib. But then no more logging on level debug ist done. May be my application does not find log4j.properties.

Regards,

Joachim Unger
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team