The advantage of having per-service log files is that it is very easy to analyze/monitor the basic logs relevant to a proxy service defined in the ESB. The service log is an additional log file, which will contain a copy of the logs to a particular proxy service.
The advantage of having per-service log files is that it is very easy to analyze/monitor what went wrong in this particular Proxy Service by looking at the service log. Enabling this feature will not terminate the
wso2-esb.log file that maintains the complete logs. The complete log will contain every log statement including the service logs that you have configured to be logged into a different log file. In other words, the service log is an additional log file, which will contain a copy of the logs to that particular service.
Follow the instructions below to configure the logs of a particular service (to be more specific a Proxy Service) to be logged into a given log file.
- See Sample 150 in Proxy Service Samples. It has a Proxy Service named
log4jto log the service-specific logs to a file called
stock-quote-proxy-service.login the logs directory of the ESB installation directory.
- Open up the
log4j.propertiesfile found in the
/repository/confdirectory of the WSO2 ESB installation directory using your favorite text editor and add the following section to the end of the file starting in a new line.
- Save the file.
- Open up the
Execute the sample client after starting the ESB with sample 150:
- Add the sample axis2 server with the
SimpleStockQuoteservice deployed on it as per stated in the sample documentation.
- Inspect the logs directory of the ESB installation directory to see the
Further, to demonstrate the log file rotation, this particular logger was configured to rotate the file in each minute whenever there is a log going into the service log, so if you execute the sample client once again after 1 minute you will be able to see the service log file rotation as well.
You can see the source here.