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