I want everything to log to the console and don't want to have to deal with creating log4j.xml files, etc. I am prototyping some libraries and want to see their full log output.
I would like to keep it as pure as possible and not have to introduce unnecessary dependencies like Spring, etc.
I use the following:
Logger.getRootLogger().setLevel(Level.ALL);
Layout layout = new PatternLayout("%d [%t] %-5p %c %x - %m%n");
Logger.getRootLogger().addAppender(new ConsoleAppender(layout));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With