annotate src/goodjava/logging/Log4jFactory.java @ 1414:4abf88ec66de

add Http.is_serving
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 08 Oct 2019 12:17:31 -0600
parents 27efb1fcbcb5
children 6fc083e1d08c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1402
27efb1fcbcb5 move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents: 1337
diff changeset
1 package goodjava.logging;
1337
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 public final class Log4jFactory extends LoggerFactory {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 private static final class Log4jLogger implements Logger {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 final org.apache.log4j.Logger log4j;
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 Log4jLogger(org.apache.log4j.Logger log4j) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 this.log4j = log4j;
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 @Override public void error(String msg) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 log4j.error(msg);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 @Override public void error(String msg,Throwable t) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 log4j.error(msg,t);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 @Override public void warn(String msg) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 log4j.warn(msg);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 @Override public void warn(String msg,Throwable t) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 log4j.warn(msg,t);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 @Override public void info(String msg) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 log4j.info(msg);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 @Override public void info(String msg,Throwable t) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 log4j.info(msg,t);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 @Override public void debug(String msg) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 log4j.debug(msg);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 @Override public void debug(String msg,Throwable t) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 log4j.debug(msg,t);
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 @Override protected Logger getLoggerImpl(Class cls) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 return new Log4jLogger(org.apache.log4j.Logger.getLogger(cls));
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49 @Override protected Logger getLoggerImpl(String name) {
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
50 return new Log4jLogger(org.apache.log4j.Logger.getLogger(name));
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52 }