org.sonatype.gossip.listener
Class FileListener

java.lang.Object
  extended by org.sonatype.gossip.listener.ListenerSupport
      extended by org.sonatype.gossip.listener.FileListener
All Implemented Interfaces:
Listener

public class FileListener
extends ListenerSupport

Writes events to a file.

Since:
1.0
Author:
Jason Dillon

Nested Class Summary
static interface FileListener.RollingStrategy
          Interface for file rolling strategy's.
 
Field Summary
static int DEFAULT_BUFFER_SIZE
           
 
Fields inherited from class org.sonatype.gossip.listener.ListenerSupport
log
 
Constructor Summary
FileListener()
           
 
Method Summary
protected  CountingWriter createWriter()
           
protected  java.lang.String evaluate(java.lang.String input)
           
 int getBufferSize()
           
 java.io.File getFile()
           
protected  java.lang.Object getProperty(java.lang.String name)
           
 FileListener.RollingStrategy getRollingStrategy()
           
 CountingWriter getWriter()
           
 boolean isAppend()
           
 void onEvent(Event event)
          Handle an event.
 void setAppend(boolean append)
           
 void setBufferSize(int n)
           
 void setFile(java.io.File file)
           
 void setFile(java.lang.String fileName)
           
 void setRollingStrategy(FileListener.RollingStrategy s)
           
 java.lang.String toString()
           
 
Methods inherited from class org.sonatype.gossip.listener.ListenerSupport
createRenderer, getRenderer, getThreshold, isLoggable, render, setRenderer, setThreshold, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

FileListener

public FileListener()
Method Detail

getFile

public java.io.File getFile()

setFile

public void setFile(java.io.File file)

setFile

public void setFile(java.lang.String fileName)

isAppend

public boolean isAppend()

setAppend

public void setAppend(boolean append)

getBufferSize

public int getBufferSize()

setBufferSize

public void setBufferSize(int n)

getRollingStrategy

public FileListener.RollingStrategy getRollingStrategy()

setRollingStrategy

public void setRollingStrategy(FileListener.RollingStrategy s)

getWriter

public CountingWriter getWriter()

createWriter

protected CountingWriter createWriter()
                               throws java.io.IOException
Throws:
java.io.IOException

onEvent

public void onEvent(Event event)
             throws java.lang.Exception
Description copied from interface: Listener
Handle an event.

Parameters:
event - The event to handle.
Throws:
java.lang.Exception - Failed to handled event.

evaluate

protected java.lang.String evaluate(java.lang.String input)

getProperty

protected java.lang.Object getProperty(java.lang.String name)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2010 Sonatype. All Rights Reserved.