1 23 24 package com.sun.jdo.spi.persistence.utility.logging; 25 26 38 39 public class LogHelper { 40 41 44 protected static boolean jdk14 = isJDK14(); 45 46 48 protected static LoggerFactory loggerFactory = null; 49 50 62 public synchronized static Logger getLogger(String loggerName, String bundleName, ClassLoader loader) { 63 if (loggerFactory == null) { 65 if (jdk14) { 66 loggerFactory = new LoggerFactoryJDK14(); 67 } else { 68 loggerFactory = new LoggerFactoryJDK13(); 69 } 70 } 71 return loggerFactory.getLogger(loggerName, bundleName, loader); 72 } 73 74 79 public static void registerLoggerFactory (LoggerFactory factory) { 80 loggerFactory = factory; 81 } 82 83 86 public static boolean isJDK14() { 87 try { 88 Class logger = Class.forName("java.util.logging.Logger"); return true; 90 } catch (ClassNotFoundException ex) { 91 return false; 92 } 93 } 94 95 } 96 | Popular Tags |