ch.qos.logback.core.net
Class SocketAppenderBase<E>

java.lang.Object
  extended by ch.qos.logback.core.spi.ContextAwareBase
      extended by ch.qos.logback.core.AppenderBase<E>
          extended by ch.qos.logback.core.net.SocketAppenderBase<E>
All Implemented Interfaces:
Appender<E>, ContextAware, FilterAttachable<E>, LifeCycle

public abstract class SocketAppenderBase<E>
extends AppenderBase<E>

This is the base class for module specific SocketAppender implementations.

Author:
Ceki Gülcü, Sébastien Pennec

Field Summary
protected  InetAddress address
           
protected  int counter
           
protected  ObjectOutputStream oos
           
protected  int port
           
protected  int reconnectionDelay
           
protected  String remoteHost
          We remember host name as String in addition to the resolved InetAddress so that it can be returned via getOption().
 
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
 
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
 
Constructor Summary
SocketAppenderBase()
           
 
Method Summary
protected  void append(E event)
           
 void cleanUp()
          Drop the connection to the remote host and release the underlying connector thread if it has been created
protected static InetAddress getAddressByName(String host)
           
 int getPort()
          Returns value of the Port property.
protected abstract  PreSerializationTransformer<E> getPST()
           
 int getReconnectionDelay()
          Returns value of the reconnectionDelay property.
 String getRemoteHost()
          Returns value of the RemoteHost property.
protected abstract  void postProcessEvent(E event)
           
 void setPort(int port)
          The Port property takes a positive integer representing the port where the server is waiting for connections.
 void setReconnectionDelay(int delay)
          The reconnectionDelay property takes a positive integer representing the number of milliseconds to wait between each failed connection attempt to the server.
 void setRemoteHost(String host)
          The RemoteHost property takes the name of of the host where a corresponding server is running.
 void start()
          Start this appender.
 void stop()
          Strop 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

remoteHost

protected String remoteHost
We remember host name as String in addition to the resolved InetAddress so that it can be returned via getOption().


address

protected InetAddress address

port

protected int port

oos

protected ObjectOutputStream oos

reconnectionDelay

protected int reconnectionDelay

counter

protected int counter
Constructor Detail

SocketAppenderBase

public SocketAppenderBase()
Method Detail

start

public void start()
Start this appender.

Specified by:
start in interface LifeCycle
Overrides:
start in class AppenderBase<E>

stop

public void stop()
Strop this appender.

This will mark the appender as closed and call then cleanUp() method.

Specified by:
stop in interface LifeCycle
Overrides:
stop in class AppenderBase<E>

cleanUp

public void cleanUp()
Drop the connection to the remote host and release the underlying connector thread if it has been created


append

protected void append(E event)
Specified by:
append in class AppenderBase<E>

postProcessEvent

protected abstract void postProcessEvent(E event)

getPST

protected abstract PreSerializationTransformer<E> getPST()

getAddressByName

protected static InetAddress getAddressByName(String host)

setRemoteHost

public void setRemoteHost(String host)
The RemoteHost property takes the name of of the host where a corresponding server is running.


getRemoteHost

public String getRemoteHost()
Returns value of the RemoteHost property.


setPort

public void setPort(int port)
The Port property takes a positive integer representing the port where the server is waiting for connections.


getPort

public int getPort()
Returns value of the Port property.


setReconnectionDelay

public void setReconnectionDelay(int delay)
The reconnectionDelay property takes a positive integer representing the number of milliseconds to wait between each failed connection attempt to the server. The default value of this option is 30000 which corresponds to 30 seconds.

Setting this option to zero turns off reconnection capability.


getReconnectionDelay

public int getReconnectionDelay()
Returns value of the reconnectionDelay property.



Copyright © 2005-2012 QOS.ch. All Rights Reserved.