Platform SDK Java 8.5 API Reference

com.genesyslab.platform.apptemplate.log4j2plugin
Class GLmsLayout

java.lang.Object
  extended by org.apache.logging.log4j.core.layout.AbstractLayout<java.lang.String>
      extended by org.apache.logging.log4j.core.layout.AbstractStringLayout
          extended by com.genesyslab.platform.apptemplate.log4j2plugin.GLmsLayout
All Implemented Interfaces:
java.io.Serializable, org.apache.logging.log4j.core.Layout<java.lang.String>

@Plugin(name="GLmsLayout",
        category="Core",
        elementType="layout",
        printObject=true)
public final class GLmsLayout
extends org.apache.logging.log4j.core.layout.AbstractStringLayout

Formats a Genesys LMS log event to write it to a log file.

Its sample usage in "log4j2.xml" configuration file may look like this:

 <Appenders>
   <GLogFile name="LmsAppender" fileName="applog">
     <GLogSegmentationStrategy segmentation="4 hrs"/>
     <GLogRolloverStrategy expiration="8 days"/>
     <GLmsLayout timeFormat="iso8601" messageFormat="full"/>
   </GLogFile>
 </Appenders>
It has following attributes:

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
footer, header, LOGGER
 
Fields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE
 
Method Summary
protected  FileHeaderProvider createFileHeaderProvider(java.lang.String providerClass)
           
static GLmsLayout createLayout(java.lang.String appName, java.lang.String hostName, java.lang.String appType, int appId, java.lang.String timeConversion, java.lang.String timeFormat, java.lang.String messageFormat, java.lang.String headerDelimiter, java.lang.String fileHeaderProvider, java.nio.charset.Charset charset, boolean alwaysWriteExceptions, boolean noConsoleNoAnsi, org.apache.logging.log4j.core.config.Configuration config)
          Creates GLmsLayout instance.
 java.util.Map<java.lang.String,java.lang.String> getContentFormat()
          Gets this PatternLayout's content format.
 FileHeaderProvider getFileHeaderProvider()
          Returns reference to the FileHeaderProvider.
 byte[] getHeader()
           
 java.lang.String toSerializable(org.apache.logging.log4j.core.LogEvent event)
          Formats a logging event to a writer.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
getBytes, getCharset, getContentType, toByteArray
 
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
getFooter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getContentFormat

public java.util.Map<java.lang.String,java.lang.String> getContentFormat()
Gets this PatternLayout's content format. Specified by:

Specified by:
getContentFormat in interface org.apache.logging.log4j.core.Layout<java.lang.String>
Overrides:
getContentFormat in class org.apache.logging.log4j.core.layout.AbstractLayout<java.lang.String>
Returns:
Map of content format keys supporting PatternLayout
See Also:
PatternLayout.getContentFormat()

getFileHeaderProvider

public FileHeaderProvider getFileHeaderProvider()
Returns reference to the FileHeaderProvider.

Returns:
The FileHeaderProvider reference.

getHeader

public byte[] getHeader()
Specified by:
getHeader in interface org.apache.logging.log4j.core.Layout<java.lang.String>
Overrides:
getHeader in class org.apache.logging.log4j.core.layout.AbstractLayout<java.lang.String>

toSerializable

public java.lang.String toSerializable(org.apache.logging.log4j.core.LogEvent event)
Formats a logging event to a writer.

Parameters:
event - logging event to be formatted.
Returns:
The event formatted as a String.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createLayout

@PluginFactory
public static GLmsLayout createLayout(@PluginAttribute(value="appName",defaultString="Application")
                                                    java.lang.String appName,
                                                    @PluginAttribute(value="hostName")
                                                    java.lang.String hostName,
                                                    @PluginAttribute(value="appType")
                                                    java.lang.String appType,
                                                    @PluginAttribute(value="appId")
                                                    int appId,
                                                    @PluginAttribute(value="timeConversion")
                                                    java.lang.String timeConversion,
                                                    @PluginAttribute(value="timeFormat")
                                                    java.lang.String timeFormat,
                                                    @PluginAttribute(value="messageFormat")
                                                    java.lang.String messageFormat,
                                                    @PluginAttribute(value="messageHeaderDelimiter")
                                                    java.lang.String headerDelimiter,
                                                    @PluginAttribute(value="fileHeaderProvider")
                                                    java.lang.String fileHeaderProvider,
                                                    @PluginAttribute(value="charset",defaultString="UTF-8")
                                                    java.nio.charset.Charset charset,
                                                    @PluginAttribute(value="alwaysWriteExceptions",defaultBoolean=true)
                                                    boolean alwaysWriteExceptions,
                                                    @PluginAttribute(value="noConsoleNoAnsi",defaultBoolean=false)
                                                    boolean noConsoleNoAnsi,
                                                    @PluginConfiguration
                                                    org.apache.logging.log4j.core.config.Configuration config)
Creates GLmsLayout instance.

Parameters:
appName - the name of "this" application to be used in the header of the log files. Default value is "Application".
hostName - the host name value to be used in the header of the log files; Log4j tries to obtain it as the local host name if this value is not specified.
appType - the type of the application to be used in the header of the log files, and in the LMS messages IDs. Default value is 0.
appId - the application DBID value to be used in the header of the log files. Default value is 0.
timeConversion - the time conversion parameter, possible values are: "utc", and "local" (default).
timeFormat - the time format, possible values are: "iso8601", "locale", and "time" (default).
messageFormat - the format of log messages header. Possible values are: "short", "medium", "full", "shortcsv", "shorttsv", and "shortdsv". In case of "shortdsv" value, the plugin uses value of headerDelimiter attribute as a delimiter between the short header fields and a log message. Default value is "medium".
headerDelimiter - it's used when messageFormat is equal to "shortdsv", representing delimiter between the short header fields and a log message.
fileHeaderProvider - fully qualified class name of FileHeaderProvider implementation. The plugin uses its default implementation if this value is not specified.
charset - the charset encoding to write the log files with. Default value is "UTF-8".
alwaysWriteExceptions - if its value is "true" (default), exceptions are always written even if the pattern contains no exception tokens.
noConsoleNoAnsi - if its value is "true" (default is false) and System.console() is null, do not output ANSI escape codes.
config - the Configuration. Some Converters require access to the Interpolator.
Returns:
GLmsLayout instance.

createFileHeaderProvider

protected FileHeaderProvider createFileHeaderProvider(java.lang.String providerClass)

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.