com.genesyslab.platform.apptemplate.log4j2plugin
Class GLogFileAppender
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilterable
org.apache.logging.log4j.core.appender.AbstractAppender
org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.rolling.RollingFileManager>
com.genesyslab.platform.apptemplate.log4j2plugin.GLogFileAppender
- All Implemented Interfaces:
- java.io.Serializable, org.apache.logging.log4j.core.Appender, org.apache.logging.log4j.core.filter.Filterable, org.apache.logging.log4j.core.LifeCycle
@Plugin(name="GLogFile",
category="Core",
elementType="appender",
printObject=true)
public final class GLogFileAppender
- extends org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.rolling.RollingFileManager>
An appender that writes to files and can roll over at intervals adding common Genesys log files
suffix like ".%d{yyyyMMdd_HHmmss_SSS}.log".
It may be used like following:
<Appenders>
<GLogFile name="LmsAppender" fileName="applog">
<GLogSegmentationStrategy segmentation="4 hrs"/>
<GLogRolloverStrategy expiration="8 files"/>
<GLmsLayout timeFormat="iso8601" messageFormat="full"/>
</GLogFile>
</Appenders>
I has following attributes:
- name - the name of the Appender (required).
- fileName - the name of the file that is actively written to. (required).
- bufferedIO - when true, I/O will be buffered. Defaults to "true".
- bufferSize - buffer size for buffered IO (default is 8192).
- immediateFlush - when true, events are immediately flushed. Defaults to "true".
- ignoreExceptions - if
"true"
(default) exceptions encountered when appending events are logged;
otherwise they are propagated to the caller.
- charset - the charset encoding to write the log files with. Default value is "UTF-8".
It also has following sub-elements:
- Triggering Policy - the rollover triggering policy.
GLogSegmentationStrategy
is designed to be used here, though, its possible
to use any other Log4j2 triggering policy.
Defaults to the default GLogSegmentationStrategy
.
- Rollover Strategy - the rollover strategy.
GLogRolloverStrategy
is designed to be used here, though, its possible
to use any other Log4j2 rollover strategy.
Defaults to the default GLogRolloverStrategy
.
- Layout - the layout to use (defaults to the default
GLmsLayout
).
- Filter - optional messages Filter.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle |
org.apache.logging.log4j.core.LifeCycle.State |
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender |
immediateFlush |
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle |
LOGGER |
Method Summary |
void |
append(org.apache.logging.log4j.core.LogEvent event)
Write the log entry rolling over the file when required. |
static GLogFileAppender |
createAppender(java.lang.String name,
java.lang.String fileName,
java.lang.String bufferedIO,
java.lang.String bufferSizeStr,
java.lang.String immediateFlush,
org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy policy,
org.apache.logging.log4j.core.appender.rolling.RolloverStrategy strategy,
org.apache.logging.log4j.core.Layout<? extends java.io.Serializable> layout,
org.apache.logging.log4j.core.Filter filter,
java.lang.String ignore,
java.lang.String advertise,
java.lang.String advertiseURI,
java.nio.charset.Charset charset,
org.apache.logging.log4j.core.config.Configuration config)
Creates a GLogFileAppender. |
java.lang.String |
getFileName()
Returns the file name for the appender. |
java.lang.String |
getFilePattern()
Returns the file pattern used when rolling over. |
<T extends org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy>
T |
|
getTriggeringPolicy()
Returns the triggering policy. |
void |
stop()
|
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender |
getManager, start |
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender |
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString |
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable |
addFilter, getFilter, hasFilter, isFiltered, removeFilter |
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle |
equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.logging.log4j.core.LifeCycle |
getState, isStarted, isStopped |
LOGFILE_DEF_EXT
protected static final java.lang.String LOGFILE_DEF_EXT
- See Also:
- Constant Field Values
LOGFILE_SUFFIX_TPL
protected static final java.lang.String LOGFILE_SUFFIX_TPL
- See Also:
- Constant Field Values
stop
public void stop()
- Specified by:
stop
in interface org.apache.logging.log4j.core.LifeCycle
- Overrides:
stop
in class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.rolling.RollingFileManager>
append
public void append(org.apache.logging.log4j.core.LogEvent event)
- Write the log entry rolling over the file when required.
- Specified by:
append
in interface org.apache.logging.log4j.core.Appender
- Overrides:
append
in class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.rolling.RollingFileManager>
- Parameters:
event
- The LogEvent.
getFileName
public java.lang.String getFileName()
- Returns the file name for the appender.
- Returns:
- The file name.
getFilePattern
public java.lang.String getFilePattern()
- Returns the file pattern used when rolling over.
- Returns:
- The file pattern.
getTriggeringPolicy
public <T extends org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy> T getTriggeringPolicy()
- Returns the triggering policy.
- Type Parameters:
T
- TriggeringPolicy type
- Returns:
- The TriggeringPolicy
createAppender
@PluginFactory
public static GLogFileAppender createAppender(@PluginAttribute(value="name")
java.lang.String name,
@PluginAttribute(value="fileName")
java.lang.String fileName,
@PluginAttribute(value="bufferedIO")
java.lang.String bufferedIO,
@PluginAttribute(value="bufferSize")
java.lang.String bufferSizeStr,
@PluginAttribute(value="immediateFlush")
java.lang.String immediateFlush,
@PluginElement(value="Policy")
org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy policy,
@PluginElement(value="Strategy")
org.apache.logging.log4j.core.appender.rolling.RolloverStrategy strategy,
@PluginElement(value="Layout")
org.apache.logging.log4j.core.Layout<? extends java.io.Serializable> layout,
@PluginElement(value="Filter")
org.apache.logging.log4j.core.Filter filter,
@PluginAttribute(value="ignoreExceptions")
java.lang.String ignore,
@PluginAttribute(value="advertise")
java.lang.String advertise,
@PluginAttribute(value="advertiseURI")
java.lang.String advertiseURI,
@PluginAttribute(value="charset",defaultString="UTF-8")
java.nio.charset.Charset charset,
@PluginConfiguration
org.apache.logging.log4j.core.config.Configuration config)
- Creates a GLogFileAppender.
- Parameters:
name
- The name of the Appender (required).fileName
- The name of the file that is actively written to. (required).bufferedIO
- When true, I/O will be buffered. Defaults to "true".bufferSizeStr
- buffer size for buffered IO (default is 8192).immediateFlush
- When true, events are immediately flushed. Defaults to "true".policy
- The rollover triggering policy (defaults to the default GLogSegmentationStrategy
).strategy
- The rollover strategy (defaults to the default GLogRolloverStrategy
).layout
- The layout to use (defaults to the default GLmsLayout
).filter
- The Filter or null.ignore
- If "true"
(default) exceptions encountered when appending events are logged; otherwise
they are propagated to the caller.advertise
- "true" if the appender configuration should be advertised, "false" otherwise.advertiseURI
- The advertised URI which can be used to retrieve the file contents.charset
- the charset encoding to write the log files with. Default value is "UTF-8".config
- The Configuration.
- Returns:
- A GLogFileAppender.
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.