Configuring system logs
To log configuration, debugging, and error informationMarketing Operations uses the Apache log4j utility. To change the types of messages that this utility includes in the system log, you change the value of the level property in the <MarketingOperations_Home>/conf/plan_log4j.xml file.
Setting the logging level
You can set the logging level to FATAL, ERROR, WARN, INFO, or DEBUG to capture an increasing number of messages. For example, to record the maximum number of messages to help troubleshoot a problem, you scroll to the end of the plan_log4j.xml file and change the level to DEBUG:
<root>
<level value="DEBUG"/>
<appender-ref ref="ASYNC_SYS_LOG"/>
</root>
When your investigation is complete, you change the level value back to the default, WARN:
<root>
<level value="WARN"/>
<appender-ref ref="ASYNC_SYS_LOG"/>
</root>
Creating a back up of a log file
You can create a back up of a log file
after it reaches a certain size by using the MaxFileSize
and
MaxBackupIndex
parameters.
MaxFileSize
is the maximum size of the log file. A back up file is created when
the log file reaches this size. MaxBackupIndex
is the maximum number of back up
files that can be created for a log file.
Consider the following example for creating a back up for the system.log file.
<appender name="SYS_LOG" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${plan.home}/logs/system.log"/>
<param name="Encoding" value="utf-8"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<param name="ImmediateFlush" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss}
[%X{user}] %-5p %F.%M:%L: %m%n"/>
</layout>
<filter class="com.unica.afc.logger.UALevelMatchFilter">
<!-- only the levels (comma separated) specified in LevelToMatch will be logged -->
<param name="LevelToMatch" value="DEBUG, WARN, INFO, ERROR, FATAL"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
</appender>
System
Log Appender
in the plan_log4j.xml file.Enabling debugging for specific functionalities
Use the preset modules in plan_log4j.xml, such as PROJECT, TASK, APPROVAL, and so on, to enable debugging for specific functionalities.
To debug specific modules, add the following loggers in the plan_log4j.xml file and uncomment the relevant sections.
<!-- ============================================================== -->
<!-- To debug specific module(s), uncomment the following logger(s) -->
<!-- ============================================================== -->
<!-- Functionality: PROJECT -->
<!--
<logger name="com.unicacorp.uap.project">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: PROGRAM -->
<!--
<logger name="com.unicacorp.uap.program">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: PLAN -->
<!--
<logger name="com.unicacorp.uap.plan">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: TASK -->
<!--
<logger name="com.unicacorp.uap.task">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: CALENDAR -->
<!--
<logger name="com.unicacorp.uap.calendar">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: TEAM -->
<!--
<logger name="com.unicacorp.uap.team">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: ASSET -->
<!--
<logger name="com.unicacorp.uap.assets">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: APPROVAL -->
<!--
<logger name="com.unicacorp.uap.approval">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: ACCOUNT -->
<!--
<logger name="com.unicacorp.uap.account">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: INVOICE -->
<!--
<logger name="com.unicacorp.uap.invoice">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: FORM EDITOR -->
<!--
<logger name="com.unicacorp.uap.formeditor">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: GRID -->
<!--
<logger name="com.unica.grid">
<level value="DEBUG"/>
</logger>
<logger name="com.unicacorp.uap.grid">
<level value="DEBUG"/>
</logger>
<logger name="com.unicacorp.uap.tvc.grid">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: TEMPLATE -->
<!--
<logger name="com.unicacorp.uap.common.template">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: NOTIFICATION -->
<!--
<logger name="com.unicacorp.uap.notification">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: OFFER -->
<!--
<logger name="com.unicacorp.uap.offer">
<level value="DEBUG"/>
</logger>
-->
<!-- Functionality: MARKETING OBJECT -->
<!--
<logger name="com.unica.uap.component">
<level value="DEBUG"/>
</logger>
-->
Generating SQL logs
You can generate SQL logs even when the root logging level is set to INFO. You can catch any SQL errors that occur without enabling the maximum level of debugging.
The SQL logs are independent from other logs and from the root level logs.
SQL_LOG
section. Otherwise, SQL logs will be generated after the upgrade.To generate SQL logs, uncomment the following section in the plan_log4j.xml file.
<!-- =============================================================== -->
<!-- SQL Log Appender -->
<!-- =============================================================== -->
<!-- IMPORTANT: The SQL logs are independent from others logs and -->
<!-- from the root level. To obtain the SQL logs, only uncomment the -->
<!-- section below. -->
<!--
<appender name="SQL_LOG" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${plan.home}/logs/sql.log"/>
<param name="Encoding" value="utf-8"/>
<param name="Append" value="true"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss}
[%X{user}] %-5p %F.%M:%L %m%n"/>
</layout>
<filter class="com.unica.afc.logger.UALevelMatchFilter">
<param name="LevelToMatch" value="SQL"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
</appender>
-->
Obtaining logs for a specific user in a specific log file
You can obtain logs for a specific
user in a specific log file by using the class
com.unica.afc.logger.UserMatchFilter
.
To generate logs for a specific user, you must add and uncomment the following section in the plan_log4j.xml file and add the required information for the specific user.
The following example creates a log file asm_admin.log, for the user asm_admin.
<!-- ================================================================ -->
<!-- To obtain log file(s) by user, uncomment the following logger(s) -->
<!-- Below is an example to obtain a log file (asm_admin.log) for the -->
<!-- 'asm_admin' user. -->
<!-- ================================================================ -->
<!--
<appender name="UserLogAppender" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${plan.home}/logs/asm_admin.log"/>
<param name="Encoding" value="utf-8"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss}
[%X{user}] %-5p %F.%M:%L: %m%n"/>
</layout>
<filter class="com.unica.afc.logger.UserMatchFilter">
<param name="StringToMatch" value="asm_admin"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
</appender>
<logger name="com.unicacorp">
<level value="DEBUG"/>
<appender-ref ref="UserLogAppender"/>
</logger>
<logger name="com.unica">
<level value="DEBUG"/>
<appender-ref ref="UserLogAppender"/>
</logger>
-->