How to Use Protomatter Syslog
1) Create the SyslogSample.java file:
import com.protomatter.syslog.Syslog;
import com.protomatter.syslog.Syslogger;
public final class SyslogSample {
public static void main(final String[] args) throws Exception {
final Syslogger logger = Syslog.getLogger(SyslogSample.class.getName());
Syslog.info(logger, "Hello World!");
}
private SyslogSample() {
}
}
2) Create the syslog.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Syslog defaultMask="DEBUG">
<Logger name="PrintWriterLog.out" class="com.protomatter.syslog.PrintWriterLog">
<Policy class="com.protomatter.syslog.SimpleLogPolicy">
<channels>ALL_CHANNEL</channels>
<logMask>INFO</logMask>
</Policy>
<stream>System.out</stream>
</Logger>
</Syslog>
3) Compile the SyslogSample.java file.
4) Set the Syslog.config.xml system property to syslog.xml.
5) Launch the SyslogSample class.
http://protomatter.sourceforge.net/
Advertisement