static void formatBadLogData ( RuntimeException error , LogData badLogData , SimpleLogHandler receiver ) { StringBuilder errorMsg = new StringBuilder ( "LOGGING ERROR: " ) . append ( error . getMessage ( ) ) . append ( ' ' ) ; int length = errorMsg . length ( ) ; try { appendLogData ( badLogData , errorMsg ) ; } catch ( RuntimeException e ) { // Reset partially written buffer when an error occurs. errorMsg . setLength ( length ) ; errorMsg . append ( "Cannot append LogData: " ) . append ( e ) ; } // Re-target this log message as a warning (or above) since it indicates a real bug. Level level = badLogData . getLevel ( ) . intValue ( ) < WARNING . intValue ( ) ? WARNING : badLogData . getLevel ( ) ; receiver . handleFormattedLogMessage ( level , errorMsg . toString ( ) , error ) ; }
Formats the log message in response to an exception during a previous logging attempt . A synthetic error message is generated from the original log data and the given exception is set as the cause . The level of this record is the maximum of WARNING or the original level .