1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  package org.apache.log4j;
18  
19  
20  import org.apache.log4j.spi.LoggerFactory;
21  import org.apache.logging.log4j.spi.LoggerContext;
22  
23  
24  
25  
26  public class Logger extends Category {
27  
28      protected Logger(final String name) {
29          super(PrivateManager.getContext(), name);
30      }
31  
32      Logger(final LoggerContext context, final String name) {
33          super(context, name);
34      }
35  
36      public static Logger getLogger(final String name) {
37          return Category.getInstance(PrivateManager.getContext(), name);
38      }
39  
40      public static Logger getLogger(final Class<?> clazz) {
41          return Category.getInstance(PrivateManager.getContext(), clazz);
42      }
43  
44      public static Logger getRootLogger() {
45          return Category.getRoot(PrivateManager.getContext());
46      }
47  
48      public static Logger getLogger(final String name, final LoggerFactory factory) {
49          return Category.getInstance(PrivateManager.getContext(), name, factory);
50      }
51  
52      
53  
54  
55      private static class PrivateManager extends org.apache.logging.log4j.LogManager {
56          private static final String FQCN = Logger.class.getName();
57  
58          public static LoggerContext getContext() {
59              return getContext(FQCN, false);
60          }
61  
62          public static org.apache.logging.log4j.Logger getLogger(final String name) {
63              return getLogger(FQCN, name);
64          }
65      }
66  }