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. All WSO2 products are shipped with the log4j logging capabilities, which generates all the administrative activities and server side logs. The log4j.properties
file, which governs how logging is performed by the server, can be found in the <PRODUCT_HOME>/repository/conf
directory.
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. Go to the documentation of your Carbon product for more details on how to use the logging feature.
Java logging and Log4j Integration
Remedies for log growth
Log growth can be managed by the following configurations in the <PRODUCT_HOME>/repository/conf/
log4j.properties
file.
- Configurable log rotation: By default, log rotation is on a daily basis.
- Log rotation based on time as opposed to size: This helps to inspect the events that occurred during a specific time.
- Log files are archived to maximise the use of space.
The log4j-
based logging mechanism uses appenders to append all the log messages into a file. That is, at the end of the log rotation period, a new file will be created with the appended logs and archived. The name of the archived log file will always contain the date on which the file is archived.