Search in sources :

Example 6 with ExtendedLogger

use of org.apache.logging.log4j.spi.ExtendedLogger in project logging-log4j2 by apache.

the class SimpleLoggerContext method getLogger.

@Override
public ExtendedLogger getLogger(final String name, final MessageFactory messageFactory) {
    // Note: This is the only method where we add entries to the 'loggerRegistry' ivar.
    final ExtendedLogger extendedLogger = loggerRegistry.getLogger(name, messageFactory);
    if (extendedLogger != null) {
        AbstractLogger.checkMessageFactory(extendedLogger, messageFactory);
        return extendedLogger;
    }
    final SimpleLogger simpleLogger = new SimpleLogger(name, defaultLevel, showLogName, showShortName, showDateTime, showContextMap, dateTimeFormat, messageFactory, props, stream);
    loggerRegistry.putIfAbsent(name, messageFactory, simpleLogger);
    return loggerRegistry.getLogger(name, messageFactory);
}
Also used : ExtendedLogger(org.apache.logging.log4j.spi.ExtendedLogger)

Aggregations

ExtendedLogger (org.apache.logging.log4j.spi.ExtendedLogger)6 Test (org.junit.Test)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 DiagnosticCollector (javax.tools.DiagnosticCollector)1 JavaCompiler (javax.tools.JavaCompiler)1 JavaFileObject (javax.tools.JavaFileObject)1 StandardJavaFileManager (javax.tools.StandardJavaFileManager)1 TestLogger (org.apache.logging.log4j.TestLogger)1 Generate (org.apache.logging.log4j.core.tools.Generate)1 MessageFactory (org.apache.logging.log4j.message.MessageFactory)1 LoggerContext (org.apache.logging.log4j.spi.LoggerContext)1 MessageSupplier (org.apache.logging.log4j.util.MessageSupplier)1 Supplier (org.apache.logging.log4j.util.Supplier)1 BeforeClass (org.junit.BeforeClass)1