1 /*
2 * Copyright (c) 2005, 2006, 2007 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.jbi4ejb;
11
12 import org.slf4j.ILoggerFactory;
13 import org.slf4j.impl.StaticLoggerBinder;
14
15 /**
16 * Factory class producing {@link Logger} for various logging APIs, most notably
17 * for Log4j and JDK 1.4 logging.
18 * <p>
19 *
20 * @author <a href="mailto:mcimatti@imolinfo.it">Marco Cimatti</a>
21 */
22 public final class LoggerFactory {
23
24 /**
25 * The internal factory used to obtain loggers.
26 */
27 private static final ILoggerFactory FACTORY
28 = StaticLoggerBinder.SINGLETON.getLoggerFactory();
29
30 /**
31 * Initializes a new instance of this class. It is declared <i>private</i>
32 * to avoid creation of instances 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 @SuppressWarnings("unchecked")
45 public static Logger getLogger(final Class clazz) {
46 return (Logger) FACTORY.getLogger(clazz.getName());
47 }
48 }