Logger definitions
You use a <Logger> element in file log4j-2.xml to
define configuration parameters for an associated <RollingFile>
appender. Using a <Logger> element, you can set the logging level
for a specific logging category associated with an appender, for example.
The following code samples illustrate this concept. In the first code sample, the <RollingFile> appender defines a file to store log messages generated by the Rule Engine as it executes Gosu in the application server. PolicyCenter then writes all messages sent to any of the RuleEngine.* logging categories to this log file.
<RollingFile name="RuleEngineLog" fileName="${guidewire.logDirectory}/ruleengine.log"
filePattern="${guidewire.logDirectory}/ruleengine.log%d{.yyyy-MM-dd}">
<PatternLayout pattern="${file.defaultPattern}" charset="UTF-8"/>
<TimeBasedTriggeringPolicy/>
</RollingFile>
The following associated <Logger> element sets several
configuration parameters related to the <RuleEngineLog> appender.
<Logger name="RuleEngine" additivity="false" level="info">
<AppenderRef ref="RuleEngineLog"/>
</Logger>
Notice the following:
- The
nameattribute defines the name of this<Logger>element. - The
additivityattribute value offalsedisables logging additivity, meaning that PolicyCenter does not propagate the logging message to any parents of the logging category. - The
levelattribute sets the logging level toinfofor all appenders that inherit from theRuleEngineappender. For example, a logging category of<RuleEngineLog.Gosu>inherits theinfolog level from the parent<RuleEngineLog>appender, unless you specifically set the logging level elsewhere. - The
refattribute specifies the name of the associated appender.
