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/.
Logging Configuration
In most systems, logging properties should be specified before the server starts and cannot be changed while it is running. However, logging properties of a running Carbon instance can be changed through its management console, while the server is up and running.
There are three main components important when configuring log4j. They are Loggers, Appenders, and Layouts. The Logging Management feature of WSO2 enables to change these parameters both globally and individually, at run time. 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 the logging properties to be updated immediately.
In WSO2 Message Broker, you also have the option of tracing messages by enabling a trace log file. See the troubleshooting guide for instructions.
Follow the instructions below to configure logging properties of the system and application logs of a Carbon server at run time.
1. Log on to the product's management console and click Configure -> Logging.
2. The Logging Configuration window appears.
Tip
If you select the Persist All Configuration Changes check box, all the modifications will be persisted and they will be available even after the server restarts.
3. The Logging Configuration window has three sections:
- Global Log4J Configuration
- Configure Log4J Appenders
- Configure Log4J Loggers
Using these sections, you can configure the layout and the amount of information about the 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 - Severity of the message. Reflects a minimum level that this logger cares about. You can view the hierarchy of levels.
- Log Pattern - Defines the output format of the log file. This is the layout pattern which describes the log message format.
If you click the Restore Defaults button, the Registry will be overwritten by the logging configurations specified in the log4j.properties file.
Configure Log4J Appenders
This section allows you to configure appenders individually. 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 Application 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 AS_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.
- Sys Log Host - The IP address of the system log server. The syslog server is a dedicated log server for many applications. It runs in a particular TCP port in a separate machine, which can be identified by an IP address.
- Facility - The log message type sent to the system log server.
- Threshold - Filters log entries based on their level. For example, threshold set to "WARN" will allow log entry to pass into appender if its level is "WARN," "ERROR" or "FATAL," other entries will be discarded. This is the minimum log level at which you can log a message.
The Available Categories of Logs you can View are:
- TRACE - Designates fine-grained informational events than the 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 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 lead the application to abort.
Configure Log4J Loggers
In this section, loggers can be filtered by the first characters (use the Starts With button) or by a combination of characters (use the Contains button).
A Logger is an object used to log messages for a specific system or application component. Loggers are normally named, using a hierarchical dot-separated namespace and have a "child-parent" relationship. For example, the logger named "root.sv" is a parent of the logger named "root.sv.sf" and a child of "root."
When the server starts for the first time, all the loggers initially listed in the log4j.properties file appear on the logger name list. This section allows you to browse through all these loggers, define a log level and switch on/off additivity to any of them. After editing, the logging properties are read only from the database.
- Logger - The name of a logger.
- Parent Logger - The name of a parent logger.
- Level - Allows to select 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 or higher to the logger’s one. If a given logger is not assigned a level, then it inherits one from its closest ancestor with an assigned level. Refer to hierarchy of levels above.
- Additivity - Allows to inherit all the appenders of the parent Logger if set as "True."
When troubleshooting, if you want per message logs, enable the following configuration in the log4j.properties file:
#log4j.logger.org.wso2.andes.server.trace=TRACE,CARBON_TRACE_LOGFILE
This has to be done manually editing the log4j.properties file. These TRACE logs will be appended to the wso2carbon-trace-messages.log file found at <MB_HOME>/repository/logs folder.