Log4jdbc does not write log files
I am trying to debug a connection leak in my Struts application and set up log4jdbc. I can see the log4jdbc logs in the console, but I want the jdbc connection open / close events to be written to the log file. Below is my log4j.properties file
log4j.debug=true
! Log connection open/close events and connection number dump
log4j.logger.jdbc.connection=INFO,connection
log4j.additivity.jdbc.connection=false
! the appender used for the JDBC Connection open and close events
log4j.appender.connection=org.apache.log4j.RollingFileAppender
log4j.appender.connection.File=C:/dev/myworkspace/log/connection.log
log4j.appender.connection.layout=org.apache.log4j.PatternLayout
log4j.appender.connection.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{1} - %m%n
log4j.appender.connection.MaxFileSize = 2000KB
log4j.appender.connection.MaxBackupIndex = 10
Please advise what is wrong with my properties file as no logs are written in the connection.log file?
+3
source to share
1 answer
Try it,
For connection parameters:
log4j.appender.connection=org.apache.log4j.RollingFileAppender
log4j.appender.connection.file=C:/dev/myworkspace/log/connection.log
log4j.appender.connection.maxFileSize=5MB
log4j.appender.connection.maxBackupIndex=5
log4j.appender.connection.append=true
log4j.appender.connection.layout=org.apache.log4j.PatternLayout
log4j.appender.connection.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Root logger option
log4j.rootLogger=INFO,file
0
source to share