comparison src/goodjava/webserver/examples/Example.java @ 1454:219f2b937f2b

remove log4j
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 08 Mar 2020 14:11:30 -0600
parents 27efb1fcbcb5
children fa066aaa068c
comparison
equal deleted inserted replaced
1453:928be2a4d565 1454:219f2b937f2b
3 import java.io.Writer; 3 import java.io.Writer;
4 import java.io.OutputStreamWriter; 4 import java.io.OutputStreamWriter;
5 import java.io.IOException; 5 import java.io.IOException;
6 import java.util.Map; 6 import java.util.Map;
7 import java.util.HashMap; 7 import java.util.HashMap;
8 import org.apache.log4j.EnhancedPatternLayout;
9 import org.apache.log4j.ConsoleAppender;
10 import org.apache.log4j.Logger;
11 import goodjava.webserver.Handler; 8 import goodjava.webserver.Handler;
12 import goodjava.webserver.Request; 9 import goodjava.webserver.Request;
13 import goodjava.webserver.Response; 10 import goodjava.webserver.Response;
14 import goodjava.webserver.ResponseOutputStream; 11 import goodjava.webserver.ResponseOutputStream;
15 import goodjava.webserver.Server; 12 import goodjava.webserver.Server;
56 handler = new SafeHandler(handler); 53 handler = new SafeHandler(handler);
57 handler = new LogHandler(handler); 54 handler = new LogHandler(handler);
58 new Server(8080,handler).start(); 55 new Server(8080,handler).start();
59 } 56 }
60 57
61 public static void initLogging() {
62 // Logger.getRootLogger().setLevel(Level.INFO);
63 EnhancedPatternLayout layout = new EnhancedPatternLayout("%d{HH:mm:ss} %-5p %c - %m%n");
64 ConsoleAppender appender = new ConsoleAppender(layout,"System.err");
65 Logger.getRootLogger().addAppender(appender);
66 }
67
68 public static void main(String[] args) throws Exception { 58 public static void main(String[] args) throws Exception {
69 initLogging();
70 fancy(); 59 fancy();
71 } 60 }
72 } 61 }