@Test public void doAppend() throws IOException { PipedOutputStream pipedOutputStream = mock( PipedOutputStream.class ); LoggingEvent loggingEvent = mock( LoggingEvent.class ); Layout testLayout = mock( Layout.class ); when( testLayout.format( loggingEvent ) ).thenReturn( "LOG_TEST_LINE" ); log4jPipedAppender.setLayout( testLayout ); log4jPipedAppender.setPipedOutputStream( pipedOutputStream ); log4jPipedAppender.doAppend( loggingEvent ); verify( pipedOutputStream ).write( ( "LOG_TEST_LINE" + Const.CR ).getBytes() ); }
public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } Log4jPipedAppender(); }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter ); }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter );  }