Open topic with navigation

TIBCO ActiveMatrix® Service Grid - Container Edition 1.0.0

# Creating a Logging Configuration for an Application

On the Log4j Configuration tab in the Application Configurator, you can create a logging configuration for an application.

1. Click the Log4j Configuration tab.

1. In the Logger tab, click Add. A row is added to the list.

2. In the Logger Name column, type a logger name. The logger name must consist of alphabet, numbers, and characters (such as period [.], underscore [_], and hyphen [-]). The name must start with a letter of the alphabet.

3. In the Appender column, select an appender from the list. You can assign multiple appenders to the logger by clicking Add New Appender .

4. Select a logging level. If there are multiple appenders, the logging level is the highest level of the assigned appenders to that particular logger.

5. (Optional) Select the check box in the Console column to enable console appender for the logger. In the Console column, you can select all the loggers by selecting the check box at the top.

1. Click anywhere outside the fields and click Save.

Updating a Logging Configuration

To update the logging configuration, edit the fields of a logger and click Save.

Deleting a Logging Configuration

To delete a logger, click Delete next to the logger. You cannot delete or edit the root logger and assign appender. But you can change the logging level (INFO, DEBUG, etc.) of the "NODE_ROOT" log appender for the root logger.

Viewing XML Configuration

To view the XML log Configuration, click Show XML in the upper-right corner.

Example:

The following example shows a sample Log4j XML configuration.

The number appended to the appender name is according to the level of the appender set for particular logger. For example, NODE_ROOT_1_50 is NODE_ROOT logger with applied level at INFO. NODE_ROOT_1_60 is NODE_ROOT logger with applied level at DEBUG.

The level of the logger is decided based on the highest level of the assigned appenders to that particular logger.

In the following example, the logger `com.tibco.amf.hpa.tibcohost` has only one FileAppender 'NODE_ROOT_1_50' assigned. Therefore, the logger level is INFO.

In the case of the logger `com.tibco.amf.admin.api.amx.application.impl`, two appenders are assigned to it, which are 'NODE_ROOT_1_50' and 'NODE_ROOT_1_60'. In this case, the higher level is DEBUG. Therefore, logger level is DEBUG.

    <appender name="NODE_ROOT_1_50" class="com.tibco.commonlogging.appender.CommonRollingFileAppender">
        <param name="File" value="{0}"/>
        <param name="MaxFileSize" value="10240KB"/>
        <param name="MaxBackupIndex" value="25"/>
        <layout class="com.tibco.tpcl.org.apache.log4j.PatternLayoutEx">
          <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss,SSS} [%t] [%-5p] %c - %m%n"/>
        </layout>
        <filter class="com.tibco.commonlogging.appender.BEFFilter">
          <param name="effectiveLevel" value="INFO"/>
        </filter>
      </appender>
      <appender name="NODE_ROOT_1_60" class="com.tibco.commonlogging.appender.CommonRollingFileAppender">
        <param name="File" value="{0}"/>
        <param name="MaxFileSize" value="10240KB"/>
        <param name="MaxBackupIndex" value="25"/>
        <layout class="com.tibco.tpcl.org.apache.log4j.PatternLayoutEx">
          <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss,SSS} [%t] [%-5p] %c - %m%n"/>
        </layout>
        <filter class="com.tibco.commonlogging.appender.BEFFilter">
          <param name="effectiveLevel" value="DEBUG"/>
        </filter>
      </appender>

    <logger name="com.tibco.amf.hpa.tibcohost" additivity="false">
        <level value="INFO"/>
        <appender-ref ref="NODE_ROOT_1_50"/>
        <appender-ref ref="CONSOLE"/>
      </logger>
    <logger name="com.tibco.amf.admin.api.amx.application.impl" additivity="false">
        <level value="DEBUG"/>
        <appender-ref ref="NODE_ROOT_1_50"/>
       <appender-ref ref="NODE_ROOT_1_60"/>
       <appender-ref ref="CONSOLE"/>
    </logger>

Note: If the same appender is assigned to the logger with the different level, the one with the highest level is only assigned to the logger.
Note: You cannot create a logger with the name 'root' (or any variant of this by case sensitivity). If you try to add such a logger, a warning message is displayed. You cannot rename the existing root logger.

Copyright © 2020-2021. TIBCO Software Inc. All Rights Reserved.