public Logger getLogger ( String loggerName ) { Logger logger ; //lookup in the cache first logger = ( Logger ) cache . get ( loggerName ) ; if ( logger == null ) { try { // get the configuration (not from the configurator because this is independent) logger = createLoggerInstance ( loggerName ) ; if ( getBootLogger ( ) . isDebugEnabled ( ) ) { getBootLogger ( ) . debug ( "Using logger class '" + ( getConfiguration ( ) != null ? getConfiguration ( ) . getLoggerClass ( ) : null ) + "' for " + loggerName ) ; } // configure the logger getBootLogger ( ) . debug ( "Initializing logger instance " + loggerName ) ; logger . configure ( conf ) ; } catch ( Throwable t ) { // do reassign check and signal logger creation failure reassignBootLogger ( true ) ; logger = getBootLogger ( ) ; getBootLogger ( ) . error ( "[" + this . getClass ( ) . getName ( ) + "] Could not initialize logger " + ( conf != null ? conf . getLoggerClass ( ) : null ) , t ) ; } //cache it so we can get it faster the next time cache . put ( loggerName , logger ) ; // do reassign check reassignBootLogger ( false ) ; } return logger ; }
returns a Logger .