Thursday, October 20, 2016

Change the Log File Location of WSO2 ESB

Lets say we need to change log file location to "/home/services/wso2logs" instead of default /repository/logs folder. 
  • Change following file locations in /repository/conf/log4j.properties as follows.
log4j.appender.SERVICE_APPENDER.File=/home/services/wso2logs/${instance.log}/wso2-esb-service${instance.log}.log
log4j.appender.TRACE_APPENDER.File=/home/services/wso2logs/${instance.log}/wso2-esb-trace${instance.log}.log
log4j.appender.CARBON_LOGFILE.File=/home/services/wso2logs/${instance.log}/wso2carbon${instance.log}.log
log4j.appender.ERROR_LOGFILE.File=/home/services/wso2logs/${instance.log}/wso2-esb-errors.log
log4j.appender.AUDIT_LOGFILE.File=/home/services/wso2logs/audit.log
log4j.appender.ATOMIKOS.File = /home/services/wso2logs/tm.out

  • Change below value in  /repository/conf/tomcat/catalina-server.xml as follows to change http_access_management_console.log file location.
Valve className="org.apache.catalina.valves.AccessLogValve" directory="/home/services/wso2logs/"

  • We still have patches.log file and empty wso2carbon.log and wso2carbon-trace-messages.log in the default location. Since patch application process is done even before the carbon server is started those log configuration file is located within org.wso2.carbon.server-.jar file. So as a workaround to move these log files we can open the log4j.properties file within /lib/org.wso2.carbon.server-.jar and change the below properties as follows.
log4j.appender.CARBON_LOGFILE.File/home/services/wso2logs/${instance.log}/wso2carbon${instance.log}.log
log4j.appender.CARBON_TRACE_LOGFILE.File=/home/services/wso2logs/${instance.log}/wso2carbon-trace-messages${instance.log}.log
log4j.appender.CARBON_PATCHES_LOGFILE.File=/home/services/wso2logs/${instance.log}/patches.log

  • Make sure write permission is there for the new location and restart the service. Now all the log files are created in the new location. 

2 comments: