Configuring IP Protection Logging

You can manage logs through a standard logging system and easily control log levels and appenders, using the logback.xml file. The IP Protection Management and IP Export Control Management logging infrastructure relies on SLF4J Logback that is the default logging framework. You can change the log level by editing the logback.xml file generated at installation.

This page discusses:

Type of Logs

IP Protection Management and IP Export Control Management manage three types of logs:

  • AccessCheck - Logs Access Denials of objects while calculating access of an object and checkout logs of documents in EXC_AccessCheck.log.
  • HistoryReport - Logs location changes of a user in EXC_HistoryReport.log.
  • jpoEXC - Logs errors and exceptions occurred in JPO in EXC_JPO_Errors.log.

Setting Up SLF4J Logging

Use the following steps to set up the SLF4J logback.

  1. Locate the logback_ECL.xml file located at <3DEXPERIENCE Server Deployment >/server/STAGING/ematrix/properties, where 3DEXPERIENCE Server Deployment is the server name.
  2. Add the logback_ECL.xml file to <3DEXPERIENCE Server Deployment >/WEB-INF/classes.
  3. Open the logback.xml file.
  4. Add <include resource=”../classes/logback_ECL.xml”/>.
  5. Restart the Tomcat

Customizing Logs

By default, the location of the logback.xml file is configured to ${MX_TRACE_FILE_PATH}. You can customize the log location, as needed.

To customize the location of the logback.xml file, define a custom property in the xml file. For example, <property name="EXC_LOGS_PATH" value="/home/data/RTV/EXC_Logs" />, where ${EXC_LOGS_PATH} replaces ${MX_TRACE_FILE_PATH}.

To change the levels of the logger, add the following log level to the logback.xml file. For more information, see the logback configuration documentation at https://logging.apache.org/log4j/.

The log levels must be one of the following:

  • ALL - All levels including custom levels.
  • DEBUG - Designates fine-grained informational events that are most useful to debug an application.
  • INFO - Designates informational messages that highlight the progress of the application at coarse-grained level.
  • WARN - Designates potentially harmful situations.
  • ERROR - Designates error events that might still allow the application to continue running.
  • FATAL - Designates very severe error events that will presumably lead the application to abort.
  • OFF - The highest possible rank and intended to turn off logging.
  • TRACE - Designates finer-grained informational events than the DEBUG.

For log messages, if a log level of at least DEBUG is set, the logs with levels greater to or equal to INFO, WARN, ERROR, and FATAL are logged.

The following is an example of the logback.xml file with the log level set to DEBUG:

<logger name="AccessCheck" level="DEBUG">
    <appender-ref ref="destAccess"/>
  </logger>

  <appender name="destHistory" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>${MX_TRACE_FILE_PATH}/EXC_HistoryReport.log</File>
    <encoder>
      <pattern>%m%n</pattern>
    </encoder>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <!-- weekly rollover -->
      <fileNamePattern>${MX_TRACE_FILE_PATH}/EXC_HistoryReport.%d{yyyy-ww}.log.zip</fileNamePattern>
      <!-- keep 4 weeks' worth of history capped at 150MB total size -->
      <maxHistory>4</maxHistory>
      <totalSizeCap>150MB</totalSizeCap>
    </rollingPolicy>
  </appender>

Configuring Appenders

Rolling or RollingFileAppender is a type of log appender that rolls over log files. For example, the appender logs to a file and when a certain condition is met, the logging target changes to another file.

To change the appender, add the following element to the logback.xml file:

  • TimeBasedRollingPolicy
  • SizeBasedTriggeringPolicy
  • SizeAndTimeBasedRollingPolicy
  • FixedWindowRollingPolicy

To configure each policy, set these attributes:

  • MaxFileSize - Determines the maximum size of a single log file before it gets archived.
  • MaxHistory - Determines the limit of archive files. Once this limit is met, the system automatically deletes older archived files.
  • TotalSizeCap - Determines the maximum size of log files including active and archived logs. Once this limit is met, the system starts deleting older archived files irrespective if the MaxHistory limit is met or not.

The following is an example of the logback.xml file with the appender attributes:

<appender name="destAccess" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>${MX_TRACE_FILE_PATH}/EXC_AccessCheck.log</File>
    <encoder>
      <pattern>[%d{ISO8601}] :: %m%n</pattern>
    </encoder>
    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
      <!-- rollover daily -->
      <fileNamePattern>${MX_TRACE_FILE_PATH}/EXC_AccessCheck-%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
       <!-- each file should be at most 150MB, keep 7 days worth of history, but at most 1GB -->
       <maxFileSize>150MB</maxFileSize>    
       <maxHistory>7</maxHistory>
       <totalSizeCap>1GB</totalSizeCap>
    </rollingPolicy>
  </appender>

For more information, see the logback documentation at http://logback.qos.ch/manual/.