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 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 log4jthe log4j.properties fileproperties 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

...

  • Carbon logs (system logs and application logs) of a running Carbon instance can be monitoring using the management console.
  • Carbon logs, as well as HTTP access logs will be printed on the command terminal that open when you execute the product startup script.
  • Alternatively, all log files can be viewed from the <PRODUCT_HOME>/repository/logs folder. This folder contains Audit logs, HTTP access logs as well as the Carbon logs in separate log files with date stamps. Note that older Carbon logs are archived in the wso2carbon.log file.