1

Following the receipt on log4j redirect stdout to DailyRollingFileAppender

And it was working until some point, and then it stopped working for some unknown reason.

Any idea of what can be wrong? i verified and im running exactly the same code as tieSystemOutAndErrToLog.

My log4j.properties is:

log4j.rootLogger = INFO, rollingFile, CONSOLE

log4j.logger.org.hibernate=INFO
log4j.logger.com.mchange=INFO
log4j.logger.com.opensymphony=WARN
log4j.logger.com.opensymphony.xwork2.ognl=ERROR

log4j.logger.org.hibernate.SQL=DEBUG, rollingFile
log4j.additivity.org.hibernate.SQL=false

#log4j.logger.com.mchange.v2.c3p0.impl.NewPooledConnection=DEBUG
#log4j.logger.com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool=DEBUG
#log4j.logger.com.mchange.v2.c3p0.impl.DefaultConnectionTester=DEBUG
log4j.logger.com.mchange.v2.resourcepool.BasicResourcePool=INFO


log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingFile.File=/export/log/alpha/frontend.log
log4j.appender.rollingFile.MaxFileSize=10MB
log4j.appender.rollingFile.MaxBackupIndex=5
log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
log4j.appender.rollingFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} - %p %t %c - %m%n

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} - %p %t %c - %m%n

in particular, im not able to log this event that is logged in catalina.out:

Dec 10, 2010 1:40:29 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException

UPDATED ANSWER: so i finally figured this out. for some obscure reason that i cannot even fathom, tomcat is not routing uncaught exceptions through log4j, and they are dumped to stdout, i had to log them in an exception page..

Community
  • 1
  • 1
Ricardo
  • 1,391
  • 4
  • 15
  • 24

3 Answers3

1

Is it possible that you reference a JAR file that contains its own log4j.property?

mfx
  • 7,168
  • 26
  • 29
  • nope. i see things being logged to /var/log/tomcat6/catalina.out but nothing in /export/log/alpha/frontend.log. And as i mentioned it was working great before.. not sure what happened.. – Ricardo Dec 10 '10 at 08:55
  • Does the fact that there is logging in catalina.out really mean that you are might not be picking up another log4j.properties file, as suggested? – Joel Dec 10 '10 at 11:40
  • no, i dont have other properties file. Besides, catalina.out is a default escape for loggging, i.e. log4j is missing these events for some reason i cannot comprehend. – Ricardo Dec 11 '10 at 23:39
0

You can add "-Dlog4j.debug" to see which log4j file you're using

davidfrancis
  • 3,734
  • 2
  • 24
  • 21
0

No permissions (of the Tomcat process owner) to write into target log file? :)

maximdim
  • 8,041
  • 3
  • 33
  • 48