private Runnable createRunnableL7dLoggingTask ( final Level level , final String key , final Object [ ] params , final Throwable t ) { // While logging, the logger thread temporarily disguises itself as its caller. final String callerThreadName = Thread . currentThread ( ) . getName ( ) ; final Runnable runnableLoggingTask = new Runnable ( ) { @ Override public void run ( ) { Thread loggerThread = Thread . currentThread ( ) ; loggerThread . setName ( callerThreadName ) ; try { m_logger . l7dlog ( level , key , params , t ) ; } catch ( Throwable t ) { System . err . println ( "Exception thrown in logging thread for " + callerThreadName + ":" + t ) ; } finally { loggerThread . setName ( ASYNCH_LOGGER_THREAD_NAME ) ; } } } ; return runnableLoggingTask ; }
Generate a runnable task that logs one localized message in an exception - safe way .