View Javadoc

1   /*
2    *  Copyright (c) 2005, 2006 Imola Informatica.
3    *  All rights reserved. This program and the accompanying materials
4    *  are made available under the terms of the LGPL License v2.1
5    *  which accompanies this distribution, and is available at
6    *  http://www.gnu.org/licenses/lgpl.html
7    */
8   
9   
10  package it.imolinfo.jbi4cics;
11  
12  
13  import org.slf4j.ILoggerFactory;
14  import org.slf4j.impl.StaticLoggerBinder;
15  
16  /**
17   * Factory class producing {@link Logger} for various logging APIs, most notably
18   * for Log4j and JDK 1.4 logging.
19   * <p>
20   *
21   * @author <a href="mailto:mcimatti@imolinfo.it">Marco Cimatti</a>
22   */
23  public final class LoggerFactory {
24  
25      /**
26       * The internal factory used to obtain loggers.
27       */
28      private static final ILoggerFactory FACTORY
29              = StaticLoggerBinder.SINGLETON.getLoggerFactory();
30  
31      /**
32       * Initializes a new instance of this class.
33       */
34      private LoggerFactory() {
35      }
36  
37      /**
38       * Returns a logger named corresponding to the class passed as parameter.
39       *
40       * @param   clazz   the returned <code>Logger</code> will be named as this
41       *                  class. Must be not <code>null</code>.
42       * @return  the logger named as <code>clazz</code>.
43       */
44      public static Logger getLogger(final Class clazz) {
45          return (Logger) FACTORY.getLogger(clazz.getName());
46      }
47  }