SK.gnome.dwarf.sample
Class SyslogHandler

java.lang.Object
  extended bySK.gnome.dwarf.GenericService
      extended bySK.gnome.dwarf.thread.ThreadService
          extended bySK.gnome.dwarf.thread.Handler
              extended bySK.gnome.dwarf.tcpip.UDPHandler
                  extended bySK.gnome.dwarf.sample.SyslogHandler
All Implemented Interfaces:
java.lang.Runnable, Service, Stoppable

public class SyslogHandler
extends UDPHandler

Sample syslog handler.

This handler parses the received UDP packets in format used by the Unix syslog service, and forwards the logging requests to the Logger.log(String, LogLevel, String) method of the current logging service returned from the GenericService.getLogger() method. Thus the remote log events are translated and diverted to the internal logging mechanism as if they were generated directly by the application code. The handler may be directly used to implement a syslog server, which will route the remote log events to the Dwarf-based logging mechanism. In order to do it, it must be added to a TCPIPServer instance together with a UDPListener instance.


Field Summary
 
Fields inherited from class SK.gnome.dwarf.thread.ThreadService
daemon, thread
 
Fields inherited from class SK.gnome.dwarf.GenericService
initParameters, parent
 
Fields inherited from interface SK.gnome.dwarf.Service
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED
 
Constructor Summary
SyslogHandler(java.lang.String name)
          Creates a new SyslogHandler.
 
Method Summary
protected  void handle(java.net.DatagramPacket packet)
          Handles the UDP syslog packet.
 
Methods inherited from class SK.gnome.dwarf.tcpip.UDPHandler
handle
 
Methods inherited from class SK.gnome.dwarf.thread.Handler
enableThread, init, loop, start
 
Methods inherited from class SK.gnome.dwarf.thread.ThreadService
finish, run, setDaemon, shutdown, stop
 
Methods inherited from class SK.gnome.dwarf.GenericService
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SyslogHandler

public SyslogHandler(java.lang.String name)
Creates a new SyslogHandler.

Method Detail

handle

protected void handle(java.net.DatagramPacket packet)
Handles the UDP syslog packet.

Specified by:
handle in class UDPHandler


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.