Logging is the act of recording events and activities that happen in a server. A properly configured logging system is vital in identifying errors, security threats and usage patterns, especially in a production-grade server. Log files provide logging information in different ways.
Logging information is usually provided in different types of log files. The most common ones in WSO2 products are the system and application logs. You can view system and application logs of a running WSO2 product instance in different ways as follows:
- Through the Management Console.
- Through the log files that are stored in
<PRODUCT_HOME>/repository/logsfolder. The folder contains current logs in a log file with a date stamp. Older logs are archived in
- Through the command prompt/shell terminal that opens when running the wso2server.bat/wso2server.sh files to start the 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, is in
<PRODUCT_HOME>/repository/conf folder. There are two ways to configuring log4j.
- Manually editing the
through the management console. Changes apply at runtime.
We recommend the second approach because you do not have to restart the server for the configuration changes to apply. When you change the parameters using the Management Console, first, the server stores new values in the database and then changes the appropriate components in the logging framework, enabling logging properties to be updated immediately. All changes made to Log4j through the management console are persisted in the WSO2 Registry and are available after server restarts. Any changes to the logging configuration you make through the management console get priority over
log4j.properties file settings. However, if you modify
log4j.properties 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
WSO2 products store logs per service. You cannot drill down service-level logs further to filter operational or query logs. We also do not provide database level logs. However, if you get SQL errors (e.g., SQL violations in your queries), you can see those errors in log type ERROR. You can also use application logs to find cause of an error.
This section covers the following information: