com.quartzdesk.api.agent.log.logback
Class LogbackInterceptionAppender<E>

java.lang.Object
  extended by ch.qos.logback.core.spi.ContextAwareBase
      extended by ch.qos.logback.core.AppenderBase<E>
          extended by com.quartzdesk.api.agent.log.logback.LogbackInterceptionAppender<E>
All Implemented Interfaces:
ch.qos.logback.core.Appender<E>, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.FilterAttachable<E>, ch.qos.logback.core.spi.LifeCycle

public class LogbackInterceptionAppender<E>
extends ch.qos.logback.core.AppenderBase<E>

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

 ==== Example logback.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.logback.LogbackInterceptionAppender">
   <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
     <level>TRACE</level>
   </filter>

   <layout class="ch.qos.logback.classic.PatternLayout">
     <pattern>[%date] %.-1level [%thread] [%logger:%line] - %msg%n</pattern>
   </layout>
 </appender>

 ...

 <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

Field Summary
protected  ch.qos.logback.core.Layout<E> layout
           
 
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
 
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
 
Constructor Summary
LogbackInterceptionAppender()
          Creates a new LogbackInterceptionAppender instance.
 
Method Summary
protected  void append(E eventObject)
          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.
protected  LoggingInterceptorWrapper.MessagePriority convertLevel2Priority(ch.qos.logback.classic.Level level)
          Returns the LoggingInterceptorWrapper.MessagePriority for the specified Logback level.
 ch.qos.logback.core.Layout<E> getLayout()
          Returns the layout used by this appender.
 void setLayout(ch.qos.logback.core.Layout<E> layout)
          Sets the layout to be used by this appender.
 void start()
          Starts this appender.
 void stop()
          Stops this appender.
 
Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
 
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
 

Field Detail

layout

protected ch.qos.logback.core.Layout<E> layout
Constructor Detail

LogbackInterceptionAppender

public LogbackInterceptionAppender()
Creates a new LogbackInterceptionAppender instance.

Method Detail

getLayout

public ch.qos.logback.core.Layout<E> getLayout()
Returns the layout used by this appender.

Returns:
the layout used by this appender.

setLayout

public void setLayout(ch.qos.logback.core.Layout<E> layout)
Sets the layout to be used by this appender.

Parameters:
layout - the layout.

start

public void start()
Starts this appender.

Specified by:
start in interface ch.qos.logback.core.spi.LifeCycle
Overrides:
start in class ch.qos.logback.core.AppenderBase<E>

stop

public void stop()
Stops this appender.

Specified by:
stop in interface ch.qos.logback.core.spi.LifeCycle
Overrides:
stop in class ch.qos.logback.core.AppenderBase<E>

append

protected void append(E eventObject)
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 ch.qos.logback.core.AppenderBase<E>
Parameters:
eventObject - a logging event object.

convertLevel2Priority

protected LoggingInterceptorWrapper.MessagePriority convertLevel2Priority(ch.qos.logback.classic.Level level)
Returns the LoggingInterceptorWrapper.MessagePriority for the specified Logback level.

Parameters:
level - a log4j level.
Returns:
the LoggingInterceptorWrapper.MessagePriority for the specified Logback level.


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