@ Override public synchronized String format ( final LogRecord record ) { buffer . setLength ( PREFIX . length ( ) ) ; buffer . append ( timestampFormatter . format ( new Date ( record . getMillis ( ) ) ) ) ; buffer . append ( ' ' ) ; buffer . append ( levelNumberToCommonsLevelName ( record . getLevel ( ) ) ) ; String [ ] parts = record . getSourceClassName ( ) . split ( "\\." ) ; buffer . append ( " [" + parts [ parts . length - 1 ] + "." + record . getSourceMethodName ( ) + "]" ) ; buffer . append ( SUFFIX ) ; buffer . append ( formatMessage ( record ) ) . append ( lineSeparator ) ; if ( record . getThrown ( ) != null ) { final StringWriter trace = new StringWriter ( ) ; record . getThrown ( ) . printStackTrace ( new PrintWriter ( trace ) ) ; buffer . append ( trace ) ; } return buffer . toString ( ) ; }
Format the given log record and return the formatted string .