/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
/** Return a new logger instance named as the first parameter using the default factory. <p>If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children. @param name The name of the logger to retrieve. */ public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
@Override public Logger getLogger(String name) { return getLogger(name, defaultFactory); }
protected org.apache.log4j.Logger getLogger() { populateMDC(); return defaultHierarchy.getLogger(name); }
protected void populateMDC() { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader != null) { if (classLoader.getClass().getName().equalsIgnoreCase("com.ironore.core.WebAppClassLoader")) { Method method = null; try { method = classLoader.getClass().getDeclaredMethod("contextPath"); method.setAccessible(true); Object contextPath = method.invoke(classLoader); MDC.put("ironore_contextPath", contextPath); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { defaultHierarchy.getLogger(Logger.class.getName()).error("unable to get context path through reflection", e); } return; } } MDC.put("ironore_contextPath", "server"); }
public static void setHierarchy(Hierarchy hierarchy) { synchronized (IsolatedLog4JLogger.class) { if ( IsolatedLog4JLogger.hierarchy == null ) { IsolatedLog4JLogger.hierarchy = hierarchy; if ( notIsolatedLoggers.size() > 0 ) { // Reroute existing IsolatedLog4JLogger instances // which were created before the new LoggerRepository. // Note: This situation should be prevented as much as // possible by calling setHierarchy from // a ServletContextListener or a Servlet its init method // which has a load-on-startup value of 0 (zero). Iterator iter = notIsolatedLoggers.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); IsolatedLog4JLogger logger = (IsolatedLog4JLogger)entry.getKey(); logger.setLogger(new Log4JLogger(hierarchy.getLogger((String)entry.getValue()))); } } notIsolatedLoggers = null; } } }
public IsolatedLog4JLogger(String name) { synchronized (IsolatedLog4JLogger.class) { if ( hierarchy == null ) { // A LogFactory.getLog(name) is called before // our ContextClassLoader Hierarchy could be set. // Temporarily save this instance so it can be // rerouted one the Hierarchy is set. logger = new Log4JLogger(name); notIsolatedLoggers.put(this,name); } else { logger = new Log4JLogger(hierarchy.getLogger(name)); } } }