com.genesyslab.platform.apptemplate.log4j2plugin
Class GLogSegmentationStrategy
java.lang.Object
com.genesyslab.platform.apptemplate.log4j2plugin.GLogSegmentationStrategy
- All Implemented Interfaces:
- org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy
@Plugin(name="GLogSegmentationStrategy",
category="Core",
printObject=true)
public class GLogSegmentationStrategy
- extends java.lang.Object
- implements org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy
The Log4j2 log files segmentation strategy (triggering policy) by original Genesys Loglib approach.
It has following parameters:
- segmentation - log files segmentation configuration; format is:
"<number> hrs"
, "<number>[ kb]"
,
"<number>[ mb]"
, or "false".
- segmStrategy - segmentation strategy, supported values are: '
OFF
',
'TIME_BASED
', 'SIZE_KB
', and 'SIZE_MB
'.
It is used if segmentation is not specified.
- segmSize - in case of time based expiration strategy it represents number of hours
of separated log file duration; in case of size based strategy it represents file size limit.
It is used if segmentation is not specified.
For example:
<Appenders>
<GLogFile name="LmsAppender" fileName="applog">
<GLogSegmentationStrategy segmentation="4 hrs"/>
<GLogRolloverStrategy expiration="8 days"/>
<MarkerFilter marker="PSDK_LMS_MESSAGE" onMatch="ACCEPT" onMismatch="DENY"/>
<GLmsLayout timeFormat="iso8601" messageFormat="full"/>
</GLogFile>
</Appenders>
or
<Appenders>
<RollingFile name="LmsAppender" fileName="applog.log" filePattern="applog.%d{yyyyMMdd_HHmmss_SSS}.log">
<GLogSegmentationStrategy segmStrategy="SIZE_MB" segmSize="10"/>
<GLogRolloverStrategy expStrategy="NUMBER_OF_FILES" expLimit="10"/>
<MarkerFilter marker="PSDK_LMS_MESSAGE" onMatch="ACCEPT" onMismatch="DENY"/>
<GLmsLayout timeFormat="iso8601" messageFormat="full"/>
</RollingFile>
</Appenders>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
segmStrategy
protected final GLogSegmentationStrategy.SegmentationStrategy segmStrategy
sizeLimit
protected final java.lang.Long sizeLimit
timeLimit
protected final java.lang.Long timeLimit
LOGGER
protected static final org.apache.logging.log4j.status.StatusLogger LOGGER
GLogSegmentationStrategy
protected GLogSegmentationStrategy(GLogSegmentationStrategy.SegmentationStrategy segmStrategy,
int size)
- Constructs a new instance.
- Parameters:
segmStrategy
- the segmentation strategy.size
- the segment size.
createStrategy
@PluginFactory
public static GLogSegmentationStrategy createStrategy(@PluginAttribute(value="segmentation")
java.lang.String segmentation,
@PluginAttribute(value="segmStrategy")
java.lang.String segmStrategy,
@PluginAttribute(value="segmSize")
java.lang.Integer segmSize,
@PluginConfiguration
org.apache.logging.log4j.core.config.Configuration config)
- Creates the GLogSegmentationStrategy.
- Parameters:
segmentation
- The segmentation configuration. Format is following:
"<number> hrs"
,
"<number> mb"
,
"<number>[ kb]"
,
or "off"/"false".segmStrategy
- The segmentation strategy type. Possible values are: 'OFF
',
'TIME_BASED
', 'SIZE_MB
',
and 'SIZE_KB
'. It is used if segmentation is not specified.segmSize
- The segmentation strategy limitation parameter. It is used if segmentation
is not specified.config
- The Configuration.
- Returns:
- A GLogSegmentationStrategy.
getStrategy
public GLogSegmentationStrategy.SegmentationStrategy getStrategy()
getSizeLimit
public java.lang.Long getSizeLimit()
getTimeLimit
public java.lang.Long getTimeLimit()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
initialize
public void initialize(org.apache.logging.log4j.core.appender.rolling.RollingFileManager manager)
- Specified by:
initialize
in interface org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy
isTriggeringEvent
public boolean isTriggeringEvent(org.apache.logging.log4j.core.LogEvent event)
- Specified by:
isTriggeringEvent
in interface org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.