WSO2 ESB:几天后还备份wso2carbon.log文件?

时间:2012-12-07 06:58:15

标签: logging wso2 wso2esb wso2carbon

在WSO2中,ESB 4.5.1在repository / logs文件夹中有several log file。但是一个重要的“wso2carbon.log”只包含一天的整个日志。然后在午夜它被冲洗了。 因为同一目录中的其他日志文件(wso2-esb-service.log或http_access.log)具有此功能,所以保留了几天。

如何保留wso2carbon.log文件几天? (WSO2应该只重命名它们,而不是删除它们。)

这是我在conf目录中的log4j.properties:

log4j.rootLogger=ERROR, CARBON_CONSOLE, CARBON_LOGFILE, CARBON_MEMORY, CARBON_SYS_LOG, ERROR_LOGFILE

log4j.category.org.apache.synapse=INFO
log4j.category.org.apache.synapse.transport=INFO
log4j.category.org.apache.axis2=INFO
log4j.category.org.apache.axis2.transport=INFO
log4j.logger.com.atomikos=INFO,ATOMIKOS
log4j.logger.org.quartz=WARN
log4j.logger.org.wso2=INFO
log4j.logger.com.avintis=INFO
log4j.logger.org.wso2.carbon=INFO
#log4j.category.org.apache.synapse.transport.nhttp.util=DEBUG
#log4j.category.org.apache.http.impl.nio.reactor=DEBUG
#log4j.logger.org.wso2.carbon.utils.deployment.ComponentBuilder=DEBUG
#log4j.logger.org.wso2.carbon.utils.deployment.OSGiBundleDeployer=DEBUG
log4j.logger.org.apache.catalina=WARN
log4j.logger.org.apache.coyote=WARN
log4j.logger.org.apache.axis2.enterprise=FATAL
log4j.logger.de.hunsicker.jalopy.io=FATAL

# uncomment the following logs to see HTTP headers and messages
#log4j.logger.org.apache.synapse.transport.nhttp.headers=DEBUG
#log4j.logger.org.apache.synapse.transport.nhttp.wire=DEBUG

# qpid related logs for the message broker
log4j.logger.qpid=WARN
log4j.logger.org.apache.qpid=WARN
log4j.logger.org.apache.qpid.server.Main=INFO
log4j.logger.qpid.message=WARN
log4j.logger.qpid.message.broker.listening=INFO

# The console appender is used to display general information at console
log4j.appender.CARBON_CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CARBON_CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CARBON_CONSOLE.layout.ConversionPattern=[%d{ISO8601}] %5p - %c{1} %m%n

# LOGEVENT is set to be a LogEventAppender using a PatternLayout to send logs to LOGEVENT 
log4j.appender.LOGEVENT=org.wso2.carbon.logging.appender.LogEventAppender
log4j.appender.LOGEVENT.url=tcp://localhost:7611
log4j.appender.LOGEVENT.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.LOGEVENT.columnList=%T,%S,%A,%d,%c,%p,%m,%I,%Stacktrace
log4j.appender.LOGEVENT.userName=admin
log4j.appender.LOGEVENT.password=admin
log4j.appender.LOGEVENT.processingLimit=1000
log4j.appender.LOGEVENT.maxTolerableConsecutiveFailure=20

# Configure the service logger at INFO level. Writes only run-time/mediation-time audit messages
log4j.category.SERVICE_LOGGER=INFO, SERVICE_APPENDER
log4j.additivity.SERVICE_LOGGER=false
log4j.appender.SERVICE_APPENDER=org.apache.log4j.RollingFileAppender
log4j.appender.SERVICE_APPENDER.File=${carbon.home}/repository/logs/${instance.log}/wso2-esb-service${instance.log}.log
log4j.appender.SERVICE_APPENDER.MaxFileSize=1000KB
log4j.appender.SERVICE_APPENDER.MaxBackupIndex=10
log4j.appender.SERVICE_APPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.SERVICE_APPENDER.layout.ConversionPattern=%d{ISO8601} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n

# The trace logger dumps enough information @INFO level, but maybe pushed upto TRACE.
# Writes only run-time/mediation time tracing/debug messages for messages passing through trace
# enabled sequences, mediators and services. Enabling tracing on these has a performance impact
log4j.category.TRACE_LOGGER=INFO, TRACE_APPENDER, TRACE_MEMORYAPPENDER
log4j.additivity.TRACE_LOGGER=false
log4j.appender.TRACE_APPENDER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.TRACE_APPENDER.File=${carbon.home}/repository/logs/${instance.log}/wso2-esb-trace${instance.log}.log
log4j.appender.TRACE_APPENDER.Append=true
log4j.appender.TRACE_APPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.TRACE_APPENDER.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n

# The memory appender for trace logger
log4j.appender.TRACE_MEMORYAPPENDER=org.wso2.carbon.logging.appenders.MemoryAppender
log4j.appender.TRACE_MEMORYAPPENDER.bufferSize=2000
log4j.appender.TRACE_MEMORYAPPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.TRACE_MEMORYAPPENDER.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%X{ip}-%X{host}] [%t] %5p %m%n

# CARBON_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout.
log4j.appender.CARBON_LOGFILE=org.apache.log4j.DailyRollingFileAppender
# Log file will be overridden by the configuration setting in the DB
# This path should be relative to WSO2 Carbon Home
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
# ConversionPattern will be overridden by the configuration setting in the DB
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

# The standard error log where all the warnings, errors and fatal errors will be logged
log4j.appender.ERROR_LOGFILE=org.apache.log4j.FileAppender
log4j.appender.ERROR_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2-esb-errors.log
log4j.appender.ERROR_LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ERROR_LOGFILE.layout.ConversionPattern=%d{ISO8601} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n
log4j.appender.ERROR_LOGFILE.threshold=WARN

# The memory appender for logging
log4j.appender.CARBON_MEMORY=org.wso2.carbon.logging.appender.CarbonMemoryAppender
log4j.appender.CARBON_MEMORY.bufferSize=2000
log4j.appender.CARBON_MEMORY.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
# ConversionPattern will be overridden by the configuration setting in the DB
log4j.appender.CARBON_MEMORY.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.CARBON_MEMORY.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.CARBON_MEMORY.columnList=%T,%S,%A,%d,%c,%p,%m,%H,%I,%Stacktrace
log4j.appender.CARBON_MEMORY.threshold=DEBUG

log4j.appender.CARBON_SYS_LOG = org.apache.log4j.net.SyslogAppender
log4j.appender.CARBON_SYS_LOG.layout=org.apache.log4j.PatternLayout
log4j.appender.CARBON_SYS_LOG.layout.ConversionPattern=[%d] %5p - %x %m {%c}%n
log4j.appender.CARBON_SYS_LOG.SyslogHost=localhost
log4j.appender.CARBON_SYS_LOG.Facility=USER
log4j.appender.CARBON_SYS_LOG.threshold=DEBUG

log4j.logger.org.apache.directory.shared.ldap=WARN, CARBON_CONSOLE
log4j.logger.org.apache.directory.server.ldap.handlers=WARN, CARBON_CONSOLE
log4j.logger.org.apache.directory.shared.ldap.entry.DefaultServerAttribute=FATAL, CARBON_CONSOLE
log4j.logger.org.apache.directory.shared.ldap.ldif.LdifReader=ERROR, CARBON_CONSOLE
log4j.logger.org.apache.directory.server.ldap.LdapProtocolHandler=ERROR, CARBON_CONSOLE

## Trace Logger configuration which will append to a XMPP chatroom or JID ##
#log4j.appender.XMPP_APPENDER=org.wso2.carbon.utils.logging.IMAppender
#log4j.appender.XMPP_APPENDER.host=jabber.org
#log4j.appender.XMPP_APPENDER.username=wso2esb
#log4j.appender.XMPP_APPENDER.password=wso2esb
#log4j.appender.XMPP_APPENDER.recipient=ruwan@jabber.org
#log4j.appender.XMPP_APPENDER.layout=org.apache.log4j.PatternLayout
#log4j.appender.XMPP_APPENDER.layout.ConversionPattern=[%X{host}] [%t] %-5p [%d{HH:mm:ss,SSS}] %C{1} - %m%n

# Appender config to send Atomikos transaction logs to new log file tm.out.
log4j.appender.ATOMIKOS = org.apache.log4j.RollingFileAppender
log4j.appender.ATOMIKOS.File = repository/logs/tm.out
log4j.appender.ATOMIKOS.Append = true
log4j.appender.ATOMIKOS.layout = org.apache.log4j.PatternLayout
log4j.appender.ATOMIKOS.layout.ConversionPattern=%p %t %c - %m%n
log4j.additivity.com.atomikos=false

3 个答案:

答案 0 :(得分:4)

您的配置看起来不错,它应该在每天结束时轮换您的日志文件。如果您是Windows用户,则报告了旋转问题[1]。这已在最新的碳包中修复

[1] - https://wso2.org/jira/browse/ESBJAVA-1614

答案 1 :(得分:0)

您应该能够使用每日滚动日志的“DailyRollingFileAppender”并将其保存在命名模式为“wso2carbon.yyy-mm-dd.log”的同一文件夹中。我相信这是默认情况下作为任何Carbon产品(包括WSO2 ESB)的log4j配置中的wso2carbon.log文件的附加程序附加的选项。

答案 2 :(得分:0)

我使用每天23:59运行的任务创建了自己的文件备份。好吧,我会丢失一分钟的日志,但这比丢失整个文件要好。