Thanks to Evgeniy. This is the complete example:
SyslogLevel
import java.util.logging.Level;
public class SyslogLevel extends Level
{
public static SyslogLevel EMERG = new SyslogLevel("EMERG", 1100);
public static SyslogLevel ALERT = new SyslogLevel("ALERT", 1000);
public static SyslogLevel ERR = new SyslogLevel("ERR", 950);
public static SyslogLevel WARNING = new SyslogLevel("WARNING", 900);
public static SyslogLevel NOTICE = new SyslogLevel("NOTICE", 850);
public static SyslogLevel INFO = new SyslogLevel("INFO", 800);
public static SyslogLevel DEBUG = new SyslogLevel("DEBUG", 300);
protected SyslogLevel (String name, int value, String resourceBundleName)
{
super (name, value, resourceBundleName);
}
protected SyslogLevel (String name, int value)
{
super (name, value);
}
}
logging
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.logging.FileHandler;
import java.util.logging.SimpleFormatter;
public class logging
{
public static void main(String[] args)
{
Logger logger = Logger.getLogger ("MyLog");
FileHandler fh;
try {
fh = new FileHandler ("logging.log", true);
logger.addHandler (fh);
logger.setLevel (Level.ALL);
fh.setFormatter (new SimpleFormatter());
logger.log (SyslogLevel.NOTICE, "Run!");
}
catch (java.io.IOException e) {
e.printStackTrace ();
}
}
}