List of usage examples for org.apache.commons.logging.impl MuleLocationAwareLog MuleLocationAwareLog
public MuleLocationAwareLog(LocationAwareLogger logger)
From source file:org.mule.module.logging.MuleLogFactory.java
public Log getInstance(String name) throws LogConfigurationException { final ClassLoader ccl = Thread.currentThread().getContextClassLoader(); ConcurrentMap<String, Log> loggerMap = repository.get(ccl == null ? NO_CCL_CLASSLOADER : ccl.hashCode()); if (loggerMap == null) { loggerMap = new ConcurrentHashMap<String, Log>(); final ConcurrentMap<String, Log> previous = repository .putIfAbsent(ccl == null ? NO_CCL_CLASSLOADER : ccl.hashCode(), loggerMap); if (previous != null) { loggerMap = previous;//from www. j a va 2s . c o m } if (ccl != null) { // must save a strong ref to the PhantomReference in order for it to stay alive and work refs.put(new PhantomReference<ClassLoader>(ccl, referenceQueue), ccl.hashCode()); } } Log instance = loggerMap.get(name); if (instance == null) { Logger logger = LoggerFactory.getLogger(name); if (logger instanceof LocationAwareLogger) { instance = new MuleLocationAwareLog((LocationAwareLogger) logger); } else { instance = new MuleLog(logger); } final Log previous = loggerMap.putIfAbsent(name, instance); if (previous != null) { // someone got there before us instance = previous; } } return instance; }