Configuring system logs
To log configuration, debugging, and error information, Unica Plan uses the Apache
log4j
utility. To change the types of messages that this utility
includes in the system log, you must change the value of the level property in the
plan_log4j.xml file placed in the
<Plan_Home>/conf/ location. The
plan_log4j.xml file is referenced in the JVM system properites by the
-Dlog4j2.configurationFile
and
-Dlog4.configurationFile
. If you are using an XML file other than
plan_log4j.xml in the properties
-Dlog4j2.configurationFile
and
-Dlog4.configurationFile
, then you must use the same file, instead of
using the plan_log4j.xml file, for the earlier mentioned
purpose
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="DEBUG" includeLocation="true">
<AppenderRef ref="SYS_LOG"/>
</Root>
When your investigation is complete, you change the level value back to the default, WARN:
<Root level="WARN" includeLocation="true">
<AppenderRef ref="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
size based trigger policy. A back up file is created when the log file reaches the size mentioned in
SizeBasedTriggeringPolicy
. The value of max attribute in DefaultRolloverStrategy
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.
<RollingFile name="SYS_LOG" fileName="${sys:plan.home}/logs/system.log"
filePattern="${sys:plan.home}/logs/system.log.%d{yyyy-MM-dd}.%i.log.gz"
immediateFlush="false" append="true" >
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%X\{user}] %-5p %F.%M:%L: %m%n" />
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
<UALevelMatchFilter levelToMatch="DEBUG, WARN,INFO, ERROR, FATAL" onMatch="ACCEPT" onMismatch="DENY"/>
</RollingFile>
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="DEBUG"/>
-->
<!-- Functionality: PROGRAM -->
<!--
<Logger name="com.unicacorp.uap.program" level="DEBUG"/>
-->
<!-- Functionality: PLAN -->
<!--
<Logger name="com.unicacorp.uap.plan" level="DEBUG"/>
-->
<!-- Functionality: TASK -->
<!--
<Logger name="com.unicacorp.uap.task" level="DEBUG"/>
-->
<!-- Functionality: CALENDAR -->
<!--
<Logger name="com.unicacorp.uap.calendar" level="DEBUG"/>
-->
<!-- Functionality: TEAM -->
<!--
<Logger name="com.unicacorp.uap.team" level="DEBUG"/>
-->
<!-- Functionality: ASSET -->
<!--
<Logger name="com.unicacorp.uap.assets" level="DEBUG"/>
-->
<!-- Functionality: APPROVAL -->
<!--
<Logger name="com.unicacorp.uap.approval" level="DEBUG"/>
-->
<!-- Functionality: ACCOUNT -->
<!--
<Logger name="com.unicacorp.uap.account" level="DEBUG"/>
-->
<!-- Functionality: INVOICE -->
<!--
<Logger name="com.unicacorp.uap.invoice" level="DEBUG"/>
-->
<!-- Functionality: FORM EDITOR -->
<!--
<Logger name="com.unicacorp.uap.formeditor" level="DEBUG"/>
-->
<!-- Functionality: GRID -->
<!--
<Logger name="com.unica.grid" level="DEBUG"/>
<Logger name="com.unicacorp.uap.grid" level="DEBUG"/>
<Logger name="com.unicacorp.uap.tvc.grid" level="DEBUG"/>
-->
<!-- Functionality: TEMPLATE -->
<!--
<Logger name="com.unicacorp.uap.common.template" level="DEBUG"/>
-->
<!-- Functionality: NOTIFICATION -->
<!--
<Logger name="com.unicacorp.uap.notification" level="DEBUG"/>
-->
<!-- Functionality: OFFER -->
<!--
<Logger name="com.unicacorp.uap.offer" level="DEBUG"/>
-->
<!-- Functionality: MARKETING OBJECT -->
<!-- <Logger name="com.unica.uap.component" level="DEBUG"/> -->
Generating SQL logs
You can generate SQL logs when the root logging level is set to DEBUG.
SQL_LOG
section. Otherwise, SQL logs will be generated
after the upgrade.
<!-- ================ -->
<!-- SQL Log Appender -->
<!-- ================ -->
<!-- uncomment the section below for obtaining sql logs -->
<!--
<RollingFile name="SQL_LOG" fileName="${sys:plan.home}/logs/sql.log"
filePattern="${sys:plan.home}/logs/sql.log.%d{yyyy-MM-dd}"
immediateFlush="false" append="true" >
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%X\{user}] %-5p %F.%M:%L: %m%n" />
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<UALevelMatchFilter levelToMatch="SQL" onMatch="ACCEPT" onMismatch="DENY"/>
</RollingFile>
-->
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. -->
<!-- ================================================================ -->
<!--
<RollingFile name="UserLogAppender" fileName="${sys:plan.home}/logs/asm_admin.log"
filePattern="${sys:plan.home}/logs/asm_admin.log.%d{yyyy-MM-dd}"
immediateFlush="false" append="true" >
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%X\{user}] %-5p %F.%M:%L: %m%n" />
<Policies>
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
<UserMatchFilter user="asm_admin" onMatch="ACCEPT" onMismatch="NEUTRAL"/>
</RollingFile>
-->
<!--
<Logger name="com.unicacorp" level="DEBUG">
<AppenderRef ref="UserLogAppender"/>
</Logger>
<Logger name="com.unica" level="DEBUG">
<AppenderRef ref="UserLogAppender"/>
</Logger>
-->