Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: revert logback updates

Table of Contents

Introduction

...

Mapper

Mapper entries are used when mapping users to groups. They are created for runtime diagnostic.

...

The Diag log may be configured either via configuration file (logback.xml replacing log4j.properties since SSO 9.0) or via SSO UI.

Configuring via

...

log4j.

...

The logback.xml file is located in ubilogin customization directory (ubilogin-sso/ubilogin/custom/logging/logback.xml) and contains the configuration of all SSO logging. Learn about Logback configuration file syntax.

The defaults for diag log entry type based logging is configured iny these lines:

Code Block
languagexml
    <turboFilter class="com.ubisecure.common.logging.MarkerBasedLogFilter">
        <DefaultLevels>audit=info;tech=info;diag.*=info</DefaultLevels>
    </turboFilter>

The syntax for DefaultLevels is the following:

  • the delimiter for individual entry type settings is semicolon (;)
  • the entry type key is one among these listed in section Entry Types in lowercase (diag.init, diag.init.environment, tech, etc.); diag.* can be used to specify all entry types starting with diag
  • the case.insensitive default level is one of these: trace, debug, info, warn, error, off and is specified after equal sign (=), e.g. tech=info
  • the default level if not specified is off

There are custom patterns that have been defined for diag console and file logging:

Code Block
languagexml
    <conversionRule conversionWord="diagex" converterClass="com.ubisecure.common.logging.LogExceptionConverter" />
    <conversionRule conversionWord="diagmarker" converterClass="com.ubisecure.common.logging.MarkerConverter" />

    <property name="CONSOLE_LOG_PATTERN"
              value="%d{'yyyy-MM-dd HH:mm:ss,SSS'} %diagmarker %level %msg %diagex%nopex%n" />
    <property name="FILE_LOG_PATTERN"
              value="%d{'yyyy-MM-dd HH:mm:ss,SSS'} %diagmarker %msg %diagex%nopex%n" />

LogExceptionConverter (diagex) controls when stack trace is printed to the log and MarkerConverter (diagmarker) prints either the entry type or the Java class name based logger category.

The diag log file name and the rotation of it is defined by this block:

Code Block
    <property name="LOG_FOLDER" value="@logs.dir.esc@" />
    <property name="UAS_LOG_FILE" value="${LOG_FOLDER}/uas3" />
...   

    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
...
        </filter>
        <encoder>
            <pattern>${FILE_LOG_PATTERN}</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${UAS_LOG_FILE}_diag.%d{yyyy-MM-dd}.log</fileNamePattern>
...
        </rollingPolicy>
    </appender>

You can also define the log level of any of the SSO or 3rd party libraries based on their category:

Code Block
    <logger name="servlet.LogLevelUpdater" level="DEBUG" />    
    <logger name="org.apache.activemq" level="INFO" />

TODO: this section below does not belong here <

or specify a log format or appender (e.g. logs for the com.ubisecure.ubilogin module should be printed only to the console):

Code Block
    <property name="CONSOLE_UBILOGIN_LOG_PATTERN"
              value="%d{'yyyy-MM-dd HH:mm:ss,SSS'} ubilogin %level %msg%n" />
...
    <appender name="CONSOLE_UBILOGIN" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${CONSOLE_UBILOGIN_LOG_PATTERN}</pattern>
        </encoder>
    </appender>
...
    <logger name="com.ubisecure.ubilogin" level="OFF"/>
    <logger name="com.ubisecure.ubilogin.admin" level="INFO">
        <appender-ref ref="CONSOLE_UBILOGIN"/>
    </logger>
...
    <root level="INFO">
...
        <appender-ref ref="CONSOLE_UBILOGIN" />
...
    </root>

TODO: this section above does not belong here >

...

properties file

The log4j.properties file is located in web application directory for the UAS module (tomcat/webapps/uas/WEB-INF/log4j.properties) and contains the configuration of all logs for the UAS. By convention the lines responsible for the diag log are set as follows:

log4j.logger.ubilogin.tech = INFO, Diag, C
log4j.logger.ubilogin.diag = INFO, Diag
log4j.logger.ubilogin.diag.init = INFO, C


log4j.appender.Diag = com.ubisecure.log4j.DailyFileAppender
log4j.appender.Diag.File = @logs.dir.esc@/uas3_diag
log4j.appender.Diag.layout = org.apache.log4j.PatternLayout
log4j.appender.Diag.layout.ConversionPattern = %d{ISO8601} %c{1} %m%n

The upper lines are responsible for setting the logging level and assigning logger types to the Diag log. The lower lines define the naming and layout of the files.
These changes are stored locally on each node. To change these settings you need to manually apply the same changes on all nodes, a restart of Tomcat may also be required.

...