View Javadoc
1   /*
2    *    Copyright 2009-2023 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
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   * @author Eduardo Macarron
24   *
25   * @deprecated Since 3.5.9 - See https://github.com/mybatis/mybatis-3/issues/1223. This class will remove future.
26   */
27  @Deprecated
28  public class Log4jImpl implements Log {
29  
30    private static final String FQCN = Log4jImpl.class.getName();
31  
32    private final Logger log;
33  
34    public Log4jImpl(String clazz) {
35      log = Logger.getLogger(clazz);
36    }
37  
38    @Override
39    public boolean isDebugEnabled() {
40      return log.isDebugEnabled();
41    }
42  
43    @Override
44    public boolean isTraceEnabled() {
45      return log.isTraceEnabled();
46    }
47  
48    @Override
49    public void error(String s, Throwable e) {
50      log.log(FQCN, Level.ERROR, s, e);
51    }
52  
53    @Override
54    public void error(String s) {
55      log.log(FQCN, Level.ERROR, s, null);
56    }
57  
58    @Override
59    public void debug(String s) {
60      log.log(FQCN, Level.DEBUG, s, null);
61    }
62  
63    @Override
64    public void trace(String s) {
65      log.log(FQCN, Level.TRACE, s, null);
66    }
67  
68    @Override
69    public void warn(String s) {
70      log.log(FQCN, Level.WARN, s, null);
71    }
72  
73  }