Logging Management

# Configure Logging

This page shows the existing Log4j configuration. And it also allows you to modify existing configuration. You can either modify the global Log4j configuration, an Appender or a Logger. If you select Persist all Configurations Changes check box, all the modifications will be persited and they will be available even after a server restart.

## Configuring Log4J Loggers

Configuring properties related to Log4J loggers.

1. In the View list, select the category of logs you want to view. The available categories are,

INFO - Information messages WARN - Warning messages ERROR - Error messages DEBUG - Debug messages TRACE - Trace messages FATAL - Fatal error messages

2. Select a Log Level (only the messages at that level and below will be logged).
   - For example, if you select Log Level ERROR, then all ERROR and FATAL messages will be logged or rather passed on to the Appender.
   - Switching on Additivity allows to inherit all the Appenders of the parent Logger.

Figure 1: Monitor Logs

## Configuring Log4J Appenders

Log4J Appenders consist of the appender name, log level, known as the Threshold, log pattern and log file.

The Threshold list is the same as the Log Level in Loggers, in name and function. You can use Log Pattern to edit the format or the layout in which the logs are created. You can refer to the log4j PatternLayout page for descriptins of the values that are used in the log pattern. Finally you can change the location of the log file with the Log File option.

1. Select the Name of the appender you wish to modify.
2. Specify the desired log pattern.
3. Select the logging threshold.
4. Click Update.

Figure 2: Configure Log4J Appenders

## Configuring Global Log4J Loggers

By using the Global Log4J configuration feature, you can set the,

- Log Level
- Log Pattern of Log4J Appenders
- Loggers to the same value at the same time.

Modify the values for the above settings as required and click Update.

Figure 3: Global Log4J Configuration

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 made to Log4j configuration through the management console are persisted in WSO2 Registry, therefore those changes will be available after server restarts. There is also an option to restore the original Log4j configuration from the log4j.properties file using the management console. But if you modify the log4j.properties file and restart the server, you will see the changes you've made. That means the earlier log4j configuration persisted in the registry is overwritten.