Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.graylog2.syslog4j.server.impl.event.printstream;
 
 import java.util.Date;
 
SystemOutSyslogServerEventHandler provides a simple example implementation of the SyslogServerEventHandlerIF which writes the events to System.out.

Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy of the LGPL license is available in the META-INF folder in all distributions of Syslog4j and in the base directory of the "doc" ZIP.

Author(s):
<syslog4j@productivity.org>
Version:
$Id: PrintStreamSyslogServerEventHandler.java,v 1.7 2010/11/28 22:07:57 cvs Exp $
    private static final long serialVersionUID = 6036415838696050746L;
    protected PrintStream stream = null;
        this. = stream;
    }
    public void initialize(SyslogServerIF syslogServer) {
        return;
    }
    public Object sessionOpened(SyslogServerIF syslogServerSocketAddress socketAddress) {
        return null;
    }
    public void event(Object sessionSyslogServerIF syslogServerSocketAddress socketAddressSyslogServerEventIF event) {
        String date = (event.getDate() == null ? new Date() : event.getDate()).toString();
        String facility = SyslogUtility.getFacilityString(event.getFacility());
        String level = SyslogUtility.getLevelString(event.getLevel());
        this..println("{" + facility + "} " + date + " " + level + " " + event.getMessage());
    }
    public void exception(Object sessionSyslogServerIF syslogServerSocketAddress socketAddressException exception) {
        //
    }
    public void sessionClosed(Object sessionSyslogServerIF syslogServerSocketAddress socketAddressboolean timeout) {
        //
    }
    public void destroy(SyslogServerIF syslogServer) {
        return;
    }
New to GrepCode? Check out our FAQ X