1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.logging.log4j;
17
18 import org.apache.ibatis.logging.Log;
19 import org.apache.log4j.Level;
20 import org.apache.log4j.Logger;
21
22
23
24
25 public class Log4jImpl implements Log {
26
27 private static final String FQCN = Log4jImpl.class.getName();
28
29 private final Logger log;
30
31 public Log4jImpl(String clazz) {
32 log = Logger.getLogger(clazz);
33 }
34
35 @Override
36 public boolean isDebugEnabled() {
37 return log.isDebugEnabled();
38 }
39
40 @Override
41 public boolean isTraceEnabled() {
42 return log.isTraceEnabled();
43 }
44
45 @Override
46 public void error(String s, Throwable e) {
47 log.log(FQCN, Level.ERROR, s, e);
48 }
49
50 @Override
51 public void error(String s) {
52 log.log(FQCN, Level.ERROR, s, null);
53 }
54
55 @Override
56 public void debug(String s) {
57 log.log(FQCN, Level.DEBUG, s, null);
58 }
59
60 @Override
61 public void trace(String s) {
62 log.log(FQCN, Level.TRACE, s, null);
63 }
64
65 @Override
66 public void warn(String s) {
67 log.log(FQCN, Level.WARN, s, null);
68 }
69
70 }