import org.apache.log4j.net.SyslogAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
class FOO {
public static void main(String args[]) {
FOO foo = new FOO();
}
public FOO () {
SimpleLayout layout = new SimpleLayout();
SyslogAppender appender = new SyslogAppender(layout, "localhost", SyslogAppender.LOG_DAEMON);
Logger logger = Logger.getRootLogger();
logger.addAppender(appender);
logger.info("This is just a test");
}
}
I'd write more about how cool log4j is, but I'm under a deadline and have to get back to work...
P.S. If this still doesn't work, then you probably forgot to make your syslog daemon listen to a socket....
No comments:
Post a Comment