问题
I seem to be having some issues with the wso2carbon.log rolling appropriately in multiple applications.
I'm running the stack on windows 2008 server with Java 1.7.
The issues are:
- ESB 4.8.1 - Log does not rotate daily, log is clobbered on application restart
- DSS 3.1.1 - Log does not rotate daily, log is clobbered on application restart
log4j.properties relevant section below:
ESB
log4j.appender.CARBON_LOGFILE=org.wso2.carbon.logging.appenders.CarbonDailyRollingFileAppender
log4j.appender.CARBON_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2carbon${instance.log}.log
log4j.appender.CARBON_LOGFILE.Append=true
log4j.appender.CARBON_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.CARBON_LOGFILE.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.CARBON_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.CARBON_LOGFILE.threshold=DEBUG
DSS
log4j.appender.CARBON_LOGFILE=org.wso2.carbon.logging.appenders.CarbonDailyRollingFileAppender
log4j.appender.CARBON_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2carbon${instance.log}.log
log4j.appender.CARBON_LOGFILE.Append=true
log4j.appender.CARBON_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.CARBON_LOGFILE.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.CARBON_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.CARBON_LOGFILE.threshold=DEBUG
I'm also running CEP 3.1.0 which appears to be rolling logs correctly, configuration below for comparison:
log4j.appender.CARBON_LOGFILE=org.wso2.carbon.logging.appenders.CarbonDailyRollingFileAppender
log4j.appender.CARBON_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2carbon${instance.log}.log
log4j.appender.CARBON_LOGFILE.Append=true
log4j.appender.CARBON_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.CARBON_LOGFILE.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m %n
log4j.appender.CARBON_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.CARBON_LOGFILE.threshold=DEBUG
Any suggestions on how to get the logs to rotate properly, or minimally not clobber on restart would be greatly appreciated. If this is an existing bug that someone knows of, please direct me to the ticket for the issue.
Thank you,
回答1:
There appear to be some differences in the logging depending on the underlying version of the WSO2 core, newer versions of the DSS appear to roll the logs as you would expect.
回答2:
Yes, it is working cleanly in WSO2 ESB 4.9.0
But unfortunately, I had to strick with WSO2 ESB 4.8.1 itself. I got this done in WSO2 4.8.1 itself by writing a custom task implementation class that simulates the size based rolling behaviour of log4j.
Refer WSO2 Log4J RollingFileAppendeder does not work in wso2esb-4.8.1 for details
来源:https://stackoverflow.com/questions/25548546/wso2carbon-log-not-rolling-as-expected