public class ProcessDetailLogger extends Object
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}"/>
<property name="WORKFLOW_LOG_FILE" value="${WORKFLOW_LOG_FILE:-${java.io.tmpdir:-/tmp}/blc-logs/workflow.log}"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
<appender name="rollingDailyEnterpriseWorkflow" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${WORKFLOW_LOG_FILE}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${WORKFLOW_LOG_FILE}.%d{yyyy-MM-dd-HH-mm}.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>[%-5level] %d{MM-dd-yyyy HH:mm:ss} %logger{35} - %message%n</pattern>
</encoder>
</appender>
<logger name="com.broadleafcommerce.enterprise.workflow.process.detail" level="DEBUG">
<appender-ref ref="rollingDailyEnterpriseWorkflow"/>
</logger>
</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 String |
logIdentifier |
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 |
init() |
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 String logIdentifier
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 configuration@PostConstruct public void init()
public 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 © 2022. All rights reserved.