com.genesyslab.platform.apptemplate.log4j2plugin
Class GLogRolloverStrategy
java.lang.Object
com.genesyslab.platform.apptemplate.log4j2plugin.GLogRolloverStrategy
- All Implemented Interfaces:
- org.apache.logging.log4j.core.appender.rolling.RolloverStrategy
@Plugin(name="GLogRolloverStrategy",
category="Core",
printObject=true)
public class GLogRolloverStrategy
- extends java.lang.Object
- implements org.apache.logging.log4j.core.appender.rolling.RolloverStrategy
The Log4j2 log files roll-over strategy by original Genesys Loglib approach.
It has following parameters:
- expiration - log files expiration configuration; format is:
"<number> days"
, "<number>[ files]"
,
or "off"/"false".
- expStrategy - expiration strategy, supported values are: '
OFF
',
'TIME_BASED
', and 'NUMBER_OF_FILES
'.
It is used if expConfig is not specified.
- expLimit - in case of time based expiration strategy it represents number of days
to keep old log files; in case of files number strategy it represents maximum number
of files to keep. It is used if expConfig is not specified.
- logfilesExt - log files extension for filtering of expired files; it's optional.
For example:
<Appenders>
<GLogFile name="LmsAppender" fileName="applog">
<GLogSegmentationStrategy segmentation="4 hrs"/>
<GLogRolloverStrategy expiration="8 files"/>
<MarkerFilter marker="PSDK_LMS_MESSAGE" onMatch="ACCEPT" onMismatch="DENY"/>
<GLmsLayout timeFormat="iso8601" messageFormat="full"/>
</GLogFile>
</Appenders>
or
<Appenders>
<RollingFile name="LmsAppender" fileName="applog" filePattern="applog.%d{yyyyMMdd_HHmmss_SSS}.log">
<GLogSegmentationStrategy segmentation="4 hrs"/>
<GLogRolloverStrategy expStrategy="NUMBER_OF_FILES" expLimit="10"/>
<MarkerFilter marker="PSDK_LMS_MESSAGE" onMatch="ACCEPT" onMismatch="DENY"/>
<GLmsLayout timeFormat="iso8601" messageFormat="full"/>
</RollingFile>
</Appenders>
Method Summary |
static GLogRolloverStrategy |
createStrategy(java.lang.String expiration,
java.lang.String expStrategy,
java.lang.Integer expLimit,
java.lang.String logfilesExt,
org.apache.logging.log4j.core.config.Configuration config)
Creates an instance of GLogRolloverStrategy. |
org.apache.logging.log4j.core.appender.rolling.RolloverDescription |
rollover(org.apache.logging.log4j.core.appender.rolling.RollingFileManager manager)
Perform the rollover. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
expStrategy
protected final GLogRolloverStrategy.ExpirationStrategy expStrategy
expLimit
protected final int expLimit
logfilesExt
protected final java.lang.String logfilesExt
LOGGER
protected static final org.apache.logging.log4j.status.StatusLogger LOGGER
GLogRolloverStrategy
protected GLogRolloverStrategy(GLogRolloverStrategy.ExpirationStrategy expStrategy,
int expLimit,
java.lang.String logfilesExt,
org.apache.logging.log4j.core.lookup.StrSubstitutor subst)
- Constructs a new instance.
- Parameters:
expStrategy
- the expiration strategy.expLimit
- the expiration limitation value.logfilesExt
- the log files extension.subst
- the strings substitutor from the logging configuration.
createStrategy
@PluginFactory
public static GLogRolloverStrategy createStrategy(@PluginAttribute(value="expiration")
java.lang.String expiration,
@PluginAttribute(value="expStrategy")
java.lang.String expStrategy,
@PluginAttribute(value="expLimit")
java.lang.Integer expLimit,
@PluginAttribute(value="logfilesExt")
java.lang.String logfilesExt,
@PluginConfiguration
org.apache.logging.log4j.core.config.Configuration config)
- Creates an instance of GLogRolloverStrategy.
- Parameters:
expiration
- the expiration configuration. Format is following:
"<number> days"
,
"<number>[ files]"
,
or "off"/"false".expStrategy
- the expiration strategy type. Possible values are: 'OFF
',
'TIME_BASED
', and 'NUMBER_OF_FILES
'.
It is used if expConfig is not specified.expLimit
- the expiration strategy limitation parameter. It is used if expConfig is not specified.logfilesExt
- the logfiles extension.config
- the Configuration.
- Returns:
- A newly created instance of GLogRolloverStrategy.
rollover
public org.apache.logging.log4j.core.appender.rolling.RolloverDescription rollover(org.apache.logging.log4j.core.appender.rolling.RollingFileManager manager)
throws java.lang.SecurityException
- Perform the rollover.
- Specified by:
rollover
in interface org.apache.logging.log4j.core.appender.rolling.RolloverStrategy
- Parameters:
manager
- The RollingFileManager name for current active log file.
- Returns:
- A RolloverDescription.
- Throws:
java.lang.SecurityException
- if an error occurs.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.