@ Override public String format ( LogRecord logRecord ) { StringBuilder resultBuilder = new StringBuilder ( ) ; String prefix = logRecord . getLevel ( ) . getName ( ) + "\t" ; resultBuilder . append ( prefix ) ; resultBuilder . append ( Thread . currentThread ( ) . getName ( ) ) . append ( " " ) . append ( sdf . format ( new java . util . Date ( logRecord . getMillis ( ) ) ) ) . append ( ": " ) . append ( logRecord . getSourceClassName ( ) ) . append ( ":" ) . append ( logRecord . getSourceMethodName ( ) ) . append ( ": " ) . append ( logRecord . getMessage ( ) ) ; Object [ ] params = logRecord . getParameters ( ) ; if ( params != null ) { resultBuilder . append ( "\nParameters:" ) ; if ( params . length < 1 ) { resultBuilder . append ( " (none)" ) ; } else { for ( int paramIndex = 0 ; paramIndex < params . length ; paramIndex ++ ) { Object param = params [ paramIndex ] ; if ( param != null ) { String paramString = param . toString ( ) ; resultBuilder . append ( "\nParameter " ) . append ( String . valueOf ( paramIndex ) ) . append ( " is a " ) . append ( param . getClass ( ) . getName ( ) ) . append ( ": >" ) . append ( paramString ) . append ( "<" ) ; } else { resultBuilder . append ( "\nParameter " ) . append ( String . valueOf ( paramIndex ) ) . append ( " is null." ) ; } } } } Throwable t = logRecord . getThrown ( ) ; if ( t != null ) { resultBuilder . append ( "\nThrowing:\n" ) . append ( getFullThrowableMsg ( t ) ) ; } String result = resultBuilder . toString ( ) . replaceAll ( "\n" , "\n" + prefix ) + "\n" ; return result ; }
Format a logging message