public class ProcessDetailLogger extends Object
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%5p] %d${HH:mm:ss$} %c${1$} - %m%n" />
</layout>
</appender>
<appender name="rollingDailyEnterpriseWorkflow" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="workflow.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%5p] %d${HH:mm:ss$} %c${1$} - %m%n" />
</layout>
</appender>
<logger name="com.broadleafcommerce.enterprise.workflow.process.detail" additivity="false">
<level value="debug"/>
<appender-ref ref="rollingDailyEnterpriseWorkflow"/>
</logger>
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>
If you duplicated the sample configuration exactly, you would provide the logger name "com.broadleafcommerce.enterprise.workflow.process.detail"
to the ProcessDetailLogger(String)
constructor.Modifier and Type | Field and Description |
---|---|
protected boolean |
disableAllProcessDetailLogging |
protected boolean |
ignoreNoProcessDetailLoggerConfiguration |
protected int |
listTemplateVariableMaxMemberCount
Max number of members that will output in the log for a collection or array member passed as a template variable
|
protected int |
stringTemplateVariableMaxLength
Max length of any String passed as a template variable
|
Constructor and Description |
---|
ProcessDetailLogger(String logIdentifier)
Construct a logger
|
Modifier and Type | Method and Description |
---|---|
int |
getListTemplateVariableMaxMemberCount() |
int |
getStringTemplateVariableMaxLength() |
void |
logProcessDetail(String logContext,
String message)
Log a message to the configured log file
|
void |
logProcessDetail(String logContext,
String messageTemplate,
Object... templateVariables)
Log a message to the configured log file
|
void |
logProcessDetail(String logContext,
Throwable e,
String message)
Log a message to the configured log file
|
void |
logProcessDetail(String logContext,
Throwable e,
String messageTemplate,
Object... templateVariables)
Log a message to the configured log file
|
protected Object[] |
processVariables(Object[] variables)
If an array or collection is passed in as part of the template variables, shorten the output if the length
exceeds a threshold.
|
void |
setListTemplateVariableMaxMemberCount(int listTemplateVariableMaxMemberCount) |
void |
setStringTemplateVariableMaxLength(int stringTemplateVariableMaxLength) |
protected int listTemplateVariableMaxMemberCount
protected int stringTemplateVariableMaxLength
@Value(value="${ignore.no.process.detail.logger.configuration:false}") protected boolean ignoreNoProcessDetailLoggerConfiguration
@Value(value="${disable.all.process.detail.logging:false}") protected boolean disableAllProcessDetailLogging
public ProcessDetailLogger(String logIdentifier)
logIdentifier
- the logger name that should be used from the backing logging system configurationpublic void logProcessDetail(String logContext, String messageTemplate, Object... templateVariables)
logContext
- a fragment describing the context of this log message - will be prepended in the log. Can be null.messageTemplate
- A template string using the same approach employed by String.format(String, Object...)
templateVariables
- the variable used to replace the %s values in the template stringpublic void logProcessDetail(String logContext, String message)
logContext
- a fragment describing the context of this log message - will be prepended in the log. Can be null.message
- a message to logpublic void logProcessDetail(String logContext, Throwable e, String messageTemplate, Object... templateVariables)
logContext
- a fragment describing the context of this log message - will be prepended in the log. Can be null.e
- an exception to include with the log message as a stack tracemessageTemplate
- A template string using the same approach employed by String.format(String, Object...)
templateVariables
- the variable used to replace the %s values in the template stringpublic void logProcessDetail(String logContext, Throwable e, String message)
logContext
- a fragment describing the context of this log message - will be prepended in the log. Can be null.e
- an exception to include with the log message as a stack tracemessage
- a message to logprotected Object[] processVariables(Object[] variables)
variables
- the template variables to process for the logpublic int getListTemplateVariableMaxMemberCount()
public void setListTemplateVariableMaxMemberCount(int listTemplateVariableMaxMemberCount)
public int getStringTemplateVariableMaxLength()
public void setStringTemplateVariableMaxLength(int stringTemplateVariableMaxLength)
Copyright © 2017. All rights reserved.