comparison src/goodjava/logger/examples/Console.java @ 1454:219f2b937f2b

remove log4j
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 08 Mar 2020 14:11:30 -0600
parents
children
comparison
equal deleted inserted replaced
1453:928be2a4d565 1454:219f2b937f2b
1 package goodjava.logger.examples;
2
3 import goodjava.logging.Logger;
4 import goodjava.logging.LoggerFactory;
5 import goodjava.logger.Layout;
6 import goodjava.logger.Layouts;
7 import goodjava.logger.DateLayout;
8 import goodjava.logger.ListLayout;
9 import goodjava.logger.Appender;
10 import goodjava.logger.ConsoleAppender;
11 import goodjava.logger.Level;
12 import goodjava.logger.SimpleConfigurer;
13 import goodjava.logger.GoodLoggerFactory;
14
15
16 public class Console {
17 private static final Logger logger = LoggerFactory.getLogger(Console.class);
18
19 public static void main(String[] args) {
20 config();
21 logger.debug("test debug");
22 logger.info("test info");
23 logger.warn("test warn");
24 logger.error("test error");
25 }
26
27 static void config() {
28 Layout layout = new ListLayout(new DateLayout("yyyy-MM-dd HH:mm:ss,SSS")," ",Layouts.LEVEL_PADDED," ",Layouts.LOGGER," - ",Layouts.MESSAGE,"\n",Layouts.THROWABLE);
29 Appender appender = new ConsoleAppender(layout,System.err);
30 GoodLoggerFactory.setConfigurer( new SimpleConfigurer(Level.INFO,appender) );
31 }
32 }