View Javadoc

1    /****************************************************************************
2    * Copyright (c) 2005, 2006, 2007, 2008, 2009 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   package it.imolinfo.jbi4corba;
10  
11  import it.imolinfo.jbi4corba.logger.JDK14LoggerFactory;
12  
13  /**
14   * Factory class producing {@link Logger} for various logging APIs, most notably
15   * for Log4j and JDK 1.4 logging.
16   * <p>
17   *
18   * @author <a href="mailto:mcimatti@imolinfo.it">Marco Cimatti</a>
19   */
20  public final class LoggerFactory {
21  
22      /**
23       * The internal factory used to obtain loggers.
24       */
25  
26  
27      private static final JDK14LoggerFactory FACTORY=new JDK14LoggerFactory();
28      /**
29       * Initializes a new instance of this class. It is declared <i>private</i>
30       * to avoid creation of instances of this class.
31       */
32      private LoggerFactory() {
33      }
34  
35      /**
36       * Returns a logger named corresponding to the class passed as parameter.
37       *
38       * @param   clazz   the returned <code>Logger</code> will be named as this
39       *                  class. Must be not <code>null</code>.
40       * @return  the logger named as <code>clazz</code>.
41       */
42      @SuppressWarnings({ "unchecked"})
43  	public static Logger getLogger(final Class clazz) {
44          return (Logger) FACTORY.getLogger(clazz.getName());
45      }
46  }