Class LogDnaAppender

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
net.zileo.logback.logdna.LogDnaAppender
All Implemented Interfaces:
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.FilterAttachable<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.LifeCycle

public class LogDnaAppender
extends ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
Logback appender for sending logs to LogDNA.com.
Author:
jlannoy
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected String appName  
    protected long connectTimeout  
    protected ch.qos.logback.classic.encoder.PatternLayoutEncoder encoder  
    protected javax.ws.rs.core.MultivaluedMap<String,​Object> headers  
    protected String hostname  
    protected String ingestUrl  
    protected List<String> mdcFields  
    protected List<String> mdcTypes  
    protected long readTimeout  
    protected String tags  
    protected boolean useTimeDrift  

    Fields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase

    name, started

    Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

    context
  • Constructor Summary

    Constructors 
    Constructor Description
    LogDnaAppender()
    Appender initialization.
  • Method Summary

    Modifier and Type Method Description
    protected void append​(ch.qos.logback.classic.spi.ILoggingEvent event)  
    protected Map<String,​Object> buildPostData​(ch.qos.logback.classic.spi.ILoggingEvent event)
    Converts a logback logging event to a JSON oriented map.
    protected javax.ws.rs.core.Response callIngestApi​(String jsonData)
    Call LogDna API posting given JSON formated string.
    protected javax.ws.rs.client.Client client()  
    protected String convertLogEventToJson​(ch.qos.logback.classic.spi.ILoggingEvent event)  
    protected LogDnaResponse convertResponseToObject​(javax.ws.rs.core.Response response)  
    boolean isDisabled()  
    void setAppName​(String appName)
    Sets the application name for LogDNA indexation.
    void setConnectTimeout​(Long connectTimeout)
    Sets the connection timeout of the underlying HTTP client, in milliseconds.
    void setEncoder​(ch.qos.logback.classic.encoder.PatternLayoutEncoder encoder)  
    void setHostname​(String hostname)
    Force a given value for the hostname LogDNA parameter.
    void setIngestKey​(String ingestKey)
    Sets your LogDNA ingest API key.
    void setIngestUrl​(String ingestUrl)
    Sets the LogDNA ingest API url.
    void setMdcFields​(String mdcFields)
    Sets the MDC fields that needs to be sent inside LogDNA metadata, separated by a comma.
    void setMdcTypes​(String mdcTypes)
    Sets the MDC fields types that will be sent inside LogDNA metadata, in the same order as mdcFields are set up, separated by a comma.
    void setReadTimeout​(Long readTimeout)
    Sets the read timeout of the underlying HTTP client, in milliseconds.
    void setTags​(String tags)
    Sets the tags that needs to be sent to LogDNA, for grouping hosts for example.
    void setUseTimeDrift​(String useTimeDrift)
    Set whether using time drift.

    Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase

    addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, start, stop, 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