If the directory/file paths specified in this guide do not exist in your WSO2 product, see Directory Structure of WSO2 Products to locate the paths applicable to your product.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Configuring Carbon logs

    You can easily configure Carbon logs using the management console of your product, or you can manually edit the log4j.properties file. It is recommended to use the management console to configure logging because all changes made to log4j through the management console persists in the WSO2 Registry. Therefore, those changes will be available after the server restarts and will get priority over what is defined in the log4j.properties file. Also, note that the logging configuration you define using the management console will apply at run time.  However, if you modify the log4j.properties file 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  log4j.properties  file.   

    Info

    Identifying forged messages:From Carbon 4.4.3 onwards, it is possible to use a UUID in log messages so that any forged messages can be easily identified.  The UUID is logged using a new conversion character ‘K’ in the log pattern layout.  By default, the UUID will be generated every time the server starts. However, you can configure your server to generate the UUID more or less frequently, by specifying an exact time interval in the log4j.properties file.

    See the following topics for instructions:

  • Configuring Audit logs

    Audit logs are enabled in WSO2 products by default. You can change the following default configuration by manually updating the the log4j.properties file. 

    Code Block
    log4j.logger.AUDIT_LOG=INFO, AUDIT_LOGFILE
     
    # Appender config to AUDIT_LOGFILE
    log4j.appender.AUDIT_LOGFILE=org.wso2.carbon.utils.logging.appenders.CarbonDailyRollingFileAppender
    log4j.appender.AUDIT_LOGFILE.File=${carbon.home}/repository/logs/audit.log
    log4j.appender.AUDIT_LOGFILE.Append=true
    log4j.appender.AUDIT_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
    log4j.appender.AUDIT_LOGFILE.layout.ConversionPattern=[%d] %P%5p {%c}- %x %m %n
    log4j.appender.AUDIT_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
    log4j.appender.AUDIT_LOGFILE.threshold=INFO
    log4j.additivity.AUDIT_LOG=false
  • Configuring HTTP access logs

    See HTTP Access Logging for instructions on how to configure and use HTTP access logs.

  • Configuring Trace logs

    Trace logs are disabled by default in WSO2 products. To enable Trace logs, the preferred log4j appender should be configured with TRACE level as the threshold in the log4j.properties file. For example, if CARBON_LOGFILE is the log4j appender, the threshold level should be changed to TRACE as shown below. The default threshold is set to DEBUG.

    Code Block
    log4j.appender.CARBON_LOGFILE.threshold=TRACE
Info

Listed below are the Log4j log level that can be configured for Carbon logs, Audit logs and Trace logs in the log4j.properties file:

Level

Description

OFF

The highest possible rank and is intended to turn off logging.

FATAL

Severe errors that cause premature termination. Expect these to be immediately visible on a status console.

ERROR

Other runtime errors or unexpected conditions. Expect these to be immediately visible on a status console.

WARN

Use of deprecated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". Expect these to be immediately visible on a status console.

INFO

Interesting runtime events (startup/shutdown). Expect these to be immediately visible on a console, so be conservative and keep to a minimum.

DEBUG

Detailed information on the flow through the system. Expect these to be written to logs only. Generally speaking, most lines logged by your application should be written as DEBUG.

TRACE

Most detailed information. Expect these to be written to logs only.

Managing log growth

See the following content on managing the growth of Carbon logs and Audit logs:

...