1 25 26 package org.objectweb.easybeans.log; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogFactory; 30 31 import org.objectweb.easybeans.i18n.I18n; 32 33 38 public final class JLogFactory { 39 40 43 private static final String COMMONS_LOGGING_PROPERTY = "easybeans.logger.commonslogging"; 44 45 48 private static boolean useCommonsLogging = false; 49 50 53 private static boolean init = false; 54 55 58 private JLogFactory() { 59 60 } 61 62 67 public static JLog getLog(final Class clazz) { 68 if (!init) { 69 String prop = System.getProperty(COMMONS_LOGGING_PROPERTY, "false"); 70 useCommonsLogging = Boolean.getBoolean(prop); 71 } 72 73 if (useCommonsLogging) { 74 Log log = LogFactory.getLog(clazz); 75 return new CommonsLoggerImpl(log, I18n.getInstance(clazz)); 76 } 77 return new JDKLogger(clazz, I18n.getInstance(clazz)); 79 80 } 81 } 82 | Popular Tags |