Thursday, August 16, 2012

Configuring a log4j logger to WSO2 ESB main sequence

Configuring separate loggers to different proxy services is a useful feature in WSO2 ESB.
You can do this by setting a log appender as follows.

log4j.category.SERVICE_LOGGER.__SynapseService=INFO, PROXY_APPENDER
log4j.additivity.PROXY_APPENDER=false
log4j.appender.PROXY_APPENDER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.PROXY_APPENDER.File=${carbon.home}/repository/logs/${instance.log}/wso2-esb-test-proxy${instance.log}.log
log4j.appender.PROXY_APPENDER.Append=true
log4j.appender.PROXY_APPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.PROXY_APPENDER.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%
view raw gistfile1.txt hosted with ❤ by GitHub
Here “__SynapseService” is the SERVICE_LOGGER for the main sequence. Similarly you can use the name of your proxy service as the SERVICE_LOGGER to manage logs separately for each of those proxies.

No comments: