Log4j Simple example

// Use Log4j in a java program
// the file log4j.config contains
// log4j.config
// log4j.rootLogger=info, stdout, R
// log4j.logger.default=ERROR
//
// TLog.java
//
// $Id$
//
 
import org.apache.log4j.*;
 
public class TLog
{
    private final static Logger LOGGER = Logger.getLogger("default");
 
    public static void main(String[] args)
    {
        PropertyConfigurator.configure("log4j.config");
        LOGGER.info("Info");
        LOGGER.warn("Warn");
        LOGGER.error("Error");
        LOGGER.debug("Debug");
        LOGGER.fatal("Fatal");
    }
}

Back to start page

log4jsimple.txt · Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0