This documentation is for WSO2 Application Server 5.2.0. View documentation for the latest release.
Introduction to Logging - Application Server 5.2.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

Logging is one of the most important aspects of a production-grade server. A properly configured logging system is vital in identifying errors, security threats and usage patterns. There are several ways that the system and application logs of a running Carbon instance can be viewed.

  • Through the Management Console.
  • Through the log files that are stored in the <PRODUCT_HOME>/repository/logs folder. This folder contains current logs in a log file with a date stamp. Older logs are archived in the wso2carbon.log file.
  • Through the command prompt/shell terminal that opens when running the "wso2server.bat"/"wso2server.sh" files to start the Carbon server.

WSO2 products use a log4j-based logging mechanism through Apache Commons Logging facade library. The log4j.properties file, which governs how logging is performed by the server, can be found in the <PRODUCT_HOME>/repository/conf directory.

The following are the ways that log4j files can be configured:

  • Manually editing the log4j.properties file.
  • Logging Configuration through the management console. These changes will be applied at run time.

The latter is recommended because all changes made to log4j through the management console are persisted in the WSO2 Registry. Therefore, those changes will be available after the server restarts. Changes that you make to the logging configuration via the management console will get priority over what is defined in the actual log4j.properties file. However, if you modify the log4j.properties file and restart the server, the earlier log4j configuration that persisted in the registry will be overwritten. There is also an option in the management console to restore the original log4j configuration from the log4j.properties file.  

Logging functionality is provided by the following feature in the WSO2 feature repository:

Name : WSO2 Carbon - Logging Management Feature
Identifier : org.wso2.carbon.logging.mgt.feature.group

If the above feature is not bundled in your product by default, you can install it using the instructions given in the Feature Management section.  

Remedies for log growth

The available remedies for log growth are as follows. However, users can edit the log4j.properties file to change the default logging configurations.

  • Log rotation is on a daily basis.
  • Log rotation is based on time as opposed to size - This is helpful to inspect the events that occurred during a specific time.
  • Log files are archived - This is helpful to reduce space.

log4j uses appenders to append all the log messages into a file. At the end of the day a new file will be created with the appended logs and archived. The name of the archived log file will always contain the date that the file was archived. 

  • No labels