com.quartzdesk.api.agent.log.log4j2
Class Log4j2InterceptionAppender<T extends Serializable>
java.lang.Object
org.apache.logging.log4j.core.filter.AbstractFilterable
org.apache.logging.log4j.core.appender.AbstractAppender<T>
com.quartzdesk.api.agent.log.log4j2.Log4j2InterceptionAppender<T>
- All Implemented Interfaces:
- org.apache.logging.log4j.core.Appender<T>, org.apache.logging.log4j.core.filter.Filterable, org.apache.logging.log4j.core.LifeCycle
public class Log4j2InterceptionAppender<T extends Serializable>
- extends org.apache.logging.log4j.core.appender.AbstractAppender<T>
Implementation of a Log4J2 appender that passes the log events to the QuartzDesk JVM agent that intercepts log
messages produced by executed jobs.
==== Example log4j2.xml ====
...
<QuartzDesk name="QUARTZDESK_JVM_AGENT">
<PatternLayout pattern="[%d{ISO8601}] %-5p [%t] [%C:%L] - %m%n"/>
<filters>
<ThresholdFilter level="trace"/>
</filters>
</QuartzDesk>
...
<root level="warn">
...
<appender-ref ref="QUARTZDESK_JVM_AGENT"/>
</root>
This implementation is not statically bound to the QuartzDesk JVM Agent API, nor to the domain object API.
Therefore it is safe to use this appender on JVMs running without an installed QuartzDesk JVM Agent.
- Version:
- $Id:$
- Author:
- Jan Moravec
- See Also:
LoggingInterceptorWrapper
| Fields inherited from class org.apache.logging.log4j.core.appender.AbstractAppender |
LOGGER |
|
Method Summary |
void |
append(org.apache.logging.log4j.core.LogEvent event)
|
protected LoggingInterceptorWrapper.MessagePriority |
convertLevel2Priority(org.apache.logging.log4j.Level level)
Returns the LoggingInterceptorWrapper.MessagePriority for the specified Log4J level. |
static
|
createAppender(String name,
String suppress,
org.apache.logging.log4j.core.Layout<T> layout,
org.apache.logging.log4j.core.Filter filter)
|
protected
<L extends org.apache.logging.log4j.core.layout.AbstractStringLayout>
Charset |
|
getLayoutCharset(L layout)
Returns the Charset used by the specified layout to format log events and produce their byte array
representations. |
| Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender |
error, error, error, getHandler, getLayout, getName, isExceptionSuppressed, isStarted, setHandler, start, stop, toString |
| Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable |
addFilter, getFilter, hasFilter, isFiltered, removeFilter, startFilter, stopFilter |
Log4j2InterceptionAppender
protected Log4j2InterceptionAppender(String name,
org.apache.logging.log4j.core.Filter filter,
org.apache.logging.log4j.core.Layout<T> layout,
boolean handleException)
- Creates a new
Log4j2InterceptionAppender instance.
- Parameters:
name - The Appender name.filter - The Filter to associate with the Appender.layout - The layout to use to format the event.handleException - If true, exceptions will be logged and suppressed. If false errors will be logged and then
passed to the application.
createAppender
public static <T extends Serializable> Log4j2InterceptionAppender<T> createAppender(String name,
String suppress,
org.apache.logging.log4j.core.Layout<T> layout,
org.apache.logging.log4j.core.Filter filter)
append
public void append(org.apache.logging.log4j.core.LogEvent event)
convertLevel2Priority
protected LoggingInterceptorWrapper.MessagePriority convertLevel2Priority(org.apache.logging.log4j.Level level)
- Returns the
LoggingInterceptorWrapper.MessagePriority for the specified Log4J level.
- Parameters:
level - a log4j level.
- Returns:
- the
LoggingInterceptorWrapper.MessagePriority for the specified Log4J level.
getLayoutCharset
protected <L extends org.apache.logging.log4j.core.layout.AbstractStringLayout> Charset getLayoutCharset(L layout)
- Returns the
Charset used by the specified layout to format log events and produce their byte array
representations.
- Parameters:
layout - a layout.
- Returns:
- the
Charset.
Copyright © 2013–2017 QuartzDesk.com. All rights reserved.