• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

log4j error

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are using log4j and most times it works fine. Sometimes when the war file is deployed on a tomcat 5.5.23 server, a message is shown. log4j:WARN No appenders could be found for logger. When that happens the log information is not written to the file. The log4j.properties file is in the war file under WEB-INF\classes. The log4j.properties file contains these lines:

log4j.defaultInitOverride = false
# Set root category priority to WARN and set its only appender to dest1.
log4j.rootLogger=DEBUG, dest1, dest2

# dest1 writes to system console.
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=[%d{MMM-dd HH:mm}] %-5p %c{1} - %m%n

# dest2 writes to file.
log4j.appender.dest2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dest2.file=/var/log/tomcat5/eCMP.log
log4j.appender.dest2.datePattern='.'yyyy-MM-dd
log4j.appender.dest2.append=true
log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
log4j.appender.dest2.layout.ConversionPattern=[%d{MMM-dd HH:mm}] %-5p %c{1} - %m%n

Does anyone have any suggestions?
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Will and welcome to Javaranch!

Will White wrote:We are using log4j and most times it works fine. Sometimes when the war file is deployed on a tomcat 5.5.23 server, a message is shown. log4j:WARN No appenders could be found for logger. When that happens the log information is not written to the file. The log4j.properties file is in the war file under WEB-INF\classes.



So it _does_ work sometimes and not others? Have you discovered a pattern of failure?

Will White wrote:
The log4j.properties file contains these lines:

log4j.defaultInitOverride = false
# Set root category priority to WARN and set its only appender to dest1.
log4j.rootLogger=DEBUG, dest1, dest2



Comment != configuration

Will White wrote:
# dest1 writes to system console.
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=[%d{MMM-dd HH:mm}] %-5p %c{1} - %m%n



Even when it complains of no appender, are you seeing console logging?

Will White wrote:
# dest2 writes to file.
log4j.appender.dest2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dest2.file=/var/log/tomcat5/eCMP.log
log4j.appender.dest2.datePattern='.'yyyy-MM-dd
log4j.appender.dest2.append=true
log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
log4j.appender.dest2.layout.ConversionPattern=[%d{MMM-dd HH:mm}] %-5p %c{1} - %m%n

Does anyone have any suggestions?



Does that location always exist with the correct permissions?

That's all I can think of right now
 
Will White
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Martijn. We have not discovered any pattern to when it fails. Every few months we have a new version of the web application that we deploy and it fails 30% of the time. We can restart tomcat and that seem to fix it and the log files are created. Therefore, I believe the permissions are fine for creating the files in the folder /var/log/tomcat5/ The console logging does not happen either when the error message shows up.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Will,

From what I understand you initially hot deploy and only bounce Tomcat when the logs don't work? I wonder if this is a straight Tomcat bug....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic