This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Setting Up Logging
There are two ways of configuring Log4j
in WSO2 Carbon: either by manually editing the log4j.properties
file or through the Management Console. Changes you make to Log4j
configuration through the Management Console are persisted in the WSO2 Registry; therefore, those changes will be applied after the server restarts. There is also an option to restore the original Log4j
configuration from the log4j.properties
file using the Management Console. However, if you modify the log4j.properties
file and restart the server, you will see the changes you have made. This means the earlier log4j
configuration changes persisted in the registry have been overwritten.
Follow the instructions below to set up logging.
- Sign in. Enter your username and password to log on to the Management Console.
- Click Configure to access the Configure menu.
- From the Configure menu, select Logging.
The Logging Configuration window appears.
If you select the "Persist All Configurations Changes" check-box, all modifications will be persisted, and they will be available even after a server restart.
- The Logging Configuration window has three sections:
Using these sections, you can configure the layout and the amount of information about system activity you want to receive.
Global Log4J Configuration
This section allows you to assign a single log level and log pattern to all loggers.
- Log Level - Reflects the minimum level that this logger is concerned with. You can view the hierarchy of levels below.
- Log Pattern - Defines the output format of the log file.
Configure Log4J Appenders
This section allows you to configure appenders. Log4j
allows logging requests to print to multiple destinations. These output destinations are called "Appenders." You can attach several appenders to one logger.
- Name- The name of an appender. By default, WSO2 Identity Server comes with the following log appenders configured:
- CARBON_CONSOLE - Logs to the console when the server is running.
- CARBON_LOGFILE - Writes the logs to
IS_HOME/repository/logs/wso2carbon.log
- CARBON_MEMORY
- CARBON_SYS_LOG - Allows separation of the software that generates messages from the system that stores them and the software that reports and analyzes them.
- CARBON_TRACE_LOGFILE
- Log pattern - Defines the output format of the log file.
- Threshold - Filters log entries based on their level. For example, a threshold set to "WARN" will allow a log entry to pass into the appender if its level is "WARN," "ERROR," or "FATAL." Other entries will be discarded.
Hierarchy of Levels:
- TRACE - Designates finer-grained informational events than DEBUG.
- DEBUG - Designates fine-grained informational events that are most useful to debug an application.
- INFO - Designates informational messages that highlight the progress of the application at a coarse-grained level.
- WARN - Designates potentially harmful situations.
- ERROR - Designates error events that might still allow the application to continue running.
- FATAL - Designates very severe error events that will presumably cause the application to abort.
Configure Log4J Loggers
This section allows you to browse through all loggers, define a log level, and switch on/off additivity to any of them.
- Logger - The name of a logger.
- Parent Logger - The name of a parent logger.
- Level - Allows you to select a level (threshold) from the drop-down menu. After you specify the level for a certain logger, a log request for that logger will only be enabled if its level is equal to or higher than the logger’s level. If a given logger is not assigned a level, then it inherits one from its closest ancestor with an assigned level. See hierarchy of levels above.
- Additivity - Allows you to inherit all appenders of the parent logger if set as "True."
In this section, loggers can be filtered by their first few characters (use the "Starts With" button) or by a combination of characters (use the "Contains" button).