Fórum

Bug: logs for portlets do not obey log4j.properties after first deployment

Franklin Phan, modificado 14 Anos atrás.

Bug: logs for portlets do not obey log4j.properties after first deployment

Regular Member Postagens: 137 Data de Entrada: 10/03/09 Postagens Recentes
I have the following in the log4j.properties for my portlet:
log4j.rootLogger=DEBUG, R

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p [%c{1}:%L] %m%n
log4j.appender.R.File=../logs/EmployeeDirectory-portlet.log
log4j.appender.R.MaxFileSize=1000KB
# Keep five backup files
log4j.appender.R.MaxBackupIndex=5

Note that it specifies max log file size (1 MB ) and max number of rolling backups (5). These parameters are adhered to only at the first deployment of the portlet. They are ignored at subsequent redeployments of the portlet, and the backup logs get deleted. The file cannot be deleted even after shutting down Tomcat (file locked by a program or process). The only solution is to reboot the workstation, delete the log file (else it will continue to grow), and restart Tomcat server. Otherwise, the log file grows continuously and unabatedly: