public static void install ( ) { synchronized ( log ( ) ) { if ( ! cInstalled ) { cInstalled = true ; cOriginalOut = System . out ; cOriginalErr = System . err ; cSystemOut = new LogEventParsingOutputStream ( log ( ) , LogEvent . INFO_TYPE ) { public boolean isEnabled ( ) { return log ( ) . isInfoEnabled ( ) ; } } ; cSystemOut . addLogListener ( log ( ) ) ; System . setOut ( new PrintStream ( cSystemOut , true ) ) ; cSystemErr = new LogEventParsingOutputStream ( log ( ) , LogEvent . ERROR_TYPE ) { public boolean isEnabled ( ) { return log ( ) . isErrorEnabled ( ) ; } } ; cSystemErr . addLogListener ( log ( ) ) ; System . setErr ( new PrintStream ( cSystemErr , true ) ) ; } } }
When installed System . out and System . err are redirected to Syslog . log . System . out produces info events and System . err produces error events .