com.quartzdesk.api.agent.log.log4j
Class Log4jInterceptionAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by com.quartzdesk.api.agent.log.log4j.Log4jInterceptionAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class Log4jInterceptionAppender
extends org.apache.log4j.AppenderSkeleton

Implementation of a Log4J appender that passes the log events to the QuartzDesk JVM agent that intercepts log messages produced by executed jobs.

 ==== Example log4j.xml ====
 ...

 <!--
   Appender that passes all received log events to the QuartzDesk agent to intercept
   log events produced by executed Quartz jobs.
 -->
 <appender name="QUARTZDESK_JVM_AGENT" class="com.quartzdesk.api.agent.log.log4j.Log4jInterceptionAppender">
   <param name="threshold" value="DEBUG"/>

   <layout class="org.apache.log4j.EnhancedPatternLayout">
     <param name="conversionPattern" value="[%d{ISO8601}] %!.1p [%t] [%C:%L] - %m%n"/>
   </layout>
 </appender>

 ...

 <root>
   <priority value="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

Field Summary
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
Log4jInterceptionAppender()
          Creates a new Log4jInterceptionAppender instance.
 
Method Summary
protected  void append(org.apache.log4j.spi.LoggingEvent event)
          If the QuartzDesk agent's logging interceptor wishes to intercept the specified logging event, then this method formats the log event using the provided pattern layout and passes the result to the logging interceptor.
 void close()
          Stops this appender.
protected  LoggingInterceptorWrapper.MessagePriority convertLevel2Priority(org.apache.log4j.Level level)
          Returns the LoggingInterceptorWrapper.MessagePriority for the specified Log4J level.
 boolean requiresLayout()
           
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log4jInterceptionAppender

public Log4jInterceptionAppender()
Creates a new Log4jInterceptionAppender instance.

Method Detail

close

public void close()
Stops this appender.


requiresLayout

public boolean requiresLayout()

append

protected void append(org.apache.log4j.spi.LoggingEvent event)
If the QuartzDesk agent's logging interceptor wishes to intercept the specified logging event, then this method formats the log event using the provided pattern layout and passes the result to the logging interceptor.

Specified by:
append in class org.apache.log4j.AppenderSkeleton
Parameters:
event - a logging event object.

convertLevel2Priority

protected LoggingInterceptorWrapper.MessagePriority convertLevel2Priority(org.apache.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.


Copyright © 2013–2017 QuartzDesk.com. All rights reserved.