Configuring the log files in JBoss

This chapter only applies to ConSol CM versions 6.13.0 and higher. For older versions, please refer to the respective manuals.

The built-in logging module of JBoss EAP is used for the ConSol CM logging subsystem (see Chapter 11. Logging with JBoss EAP on the RedHat website for detailed information about logging in JBoss). Usually, you do not have to change any log settings.

The configuration of the logging subsystem is defined in one of the following files, depending on the infrastructure of your CM system:

Usually, you do not need to edit the XML files.

You can modify the default configuration in the respective configuration file:

For configuring the logging behavior, the following section of the configuration file is relevant:

<subsystem xmlns="urn:jboss:domain:logging:3.0">

Within the section of this subsystem, the file handlers are defined, each in a separate subsection. By default, periodic size rotating file handlers are used. One log file is created for every day. If the maximum size of 50 MB is exceeded, a new file is created for this day. 10 files are kept as backup.

Example from the index.log section:

<periodic-size-rotating-file-handler name="INDEX_FILE" autoflush="true">

<level name="${handler.indexfile.level:INFO}"/>

<formatter>

<pattern-formatter pattern="%d %-5.5p [%30.-30c] [%X{username}-%X{context}-%X{sessionId}] %m%n"/>

</formatter>

<file relative-to="jboss.server.log.dir" path="index.log"/>

<suffix value=".yyyy.MM.dd"/>

<max-backup-index value="${handler.indexfile.max.backup.index:10}"/>

<rotate-size value="${handler.indexfile.rotate.size:50m}"/>

<append value="true"/>

</periodic-size-rotating-file-handler>

Below the file handlers, the loggers are defined. For each logger, the target file(s) and the log level are provided.

<logger category="com.consol.cmas.core.index" use-parent-handlers="false">

<level name="${logger.com.consol.cmas.core.index.level:INFO}"/>

<handlers>

<handler name="INDEX_FILE"/>

</handlers>

</logger>

This means that the logger for classes belonging to com.consol.cmas.core.index writes into the file INDEX_FILE, which is defined in the file handler section above.

The variables in the syntax ${setting:value}, e.g. ${handler.indexfile.level:INFO}, indicate parameters which can be overridden in the <JBOSS_HOME>/bin/cm6-config.properties or <JBOSS_HOME>/bin/cm6-cmrf-config.properties file.

Changing default settings

The following example shows how to change default settings using the cm6-config.properties or cm6-cmrf-config.properties file.

Goal: You want to change the log level of the index.log file to DEBUG.

  1. Locate the respective handler in the configuration file (example from cm6-mysql.xml).

    <periodic-size-rotating-file-handler name="INDEX_FILE" autoflush="true">

    <level name="${handler.indexfile.level:INFO}"/>

    <formatter>

    <pattern-formatter pattern="%d %-5.5p [%30.-30c] [%X{username}-%X{context}-%X{sessionId}] %m%n"/>

    </formatter>

    <file relative-to="jboss.server.log.dir" path="index.log"/>

    <suffix value=".yyyy.MM.dd"/>

    <max-backup-index value="${handler.indexfile.max.backup.index:10}"/>

    <rotate-size value="${handler.indexfile.rotate.size:50m}"/>

    <append value="true"/>

    </periodic-size-rotating-file-handler>

  2. Locate the variable for the log level.

    This is ${handler.indexfile.level:INFO}.

  3. Add an entry for this variable to cm6-config.properties.

    # logging overrides

    handler.indexfile.level=DEBUG

Other changes you can make:

If there is no variable for a setting which you want to modify, you can edit the cm6-<DB>.xml file directly. This is required for example if you want to change the pattern for the log file entries (pattern-formatter attribute).