@Test public void testAddLogEventTrans() { when( logObjProvider.apply( logChannelId ) ).thenReturn( loggingObject ); when( loggingObject.getLogChannelId() ).thenReturn( logChannelId ); when( loggingObject.getObjectType() ).thenReturn( LoggingObjectType.TRANS ); when( loggingObject.getFilename() ).thenReturn( "filename" ); when( message.getLevel() ).thenReturn( LogLevel.BASIC ); listener.eventAdded( logEvent ); verify( transLogger ).info( "[filename] " + msgText ); when( message.getLevel() ).thenReturn( LogLevel.ERROR ); listener.eventAdded( logEvent ); verify( transLogger ).error( "[filename] " + msgText ); verifyZeroInteractions( diLogger ); verifyZeroInteractions( jobLogger ); }
@Override public void eventAdded( KettleLoggingEvent event ) { Object messageObject = event.getMessage(); checkNotNull( messageObject, "Expected log message to be defined." ); if ( messageObject instanceof LogMessage ) { LogMessage message = (LogMessage) messageObject; LoggingObjectInterface loggingObject = logObjProvider.apply( message.getLogChannelId() ); if ( loggingObject == null ) { logToLogger( diLogger, message.getLevel(), message.getSubject() + " " + message.getMessage() ); } else if ( loggingObject.getObjectType() == TRANS || loggingObject.getObjectType() == STEP || loggingObject.getObjectType() == DATABASE ) { logToLogger( transLogger, message.getLevel(), loggingObject, message ); } else if ( loggingObject.getObjectType() == JOB || loggingObject.getObjectType() == JOBENTRY ) { logToLogger( jobLogger, message.getLevel(), loggingObject, message ); } } }
Slf4jLoggingEventListener implements KettleLoggingEventListener { @Override public void eventAdded( KettleLoggingEvent event ) { Object messageObject = event.getMessage(); checkNotNull( messageObject, "Expected log message to be defined." ); if ( messageObject instanceof LogMessage ) { LogMessage message = (LogMessage) messageObject; LoggingObjectInterface loggingObject = logObjProvider.apply( message.getLogChannelId() ); if ( loggingObject == null ) { logToLogger( diLogger, message.getLevel(), message.getSubject() + " " + message.getMessage() ); } else if ( loggingObject.getObjectType() == TRANS || loggingObject.getObjectType() == STEP || loggingObject.getObjectType() == DATABASE ) { logToLogger( transLogger, message.getLevel(), loggingObject, message ); } else if ( loggingObject.getObjectType() == JOB || loggingObject.getObjectType() == JOBENTRY ) { logToLogger( jobLogger, message.getLevel(), loggingObject, message ); } } } }
Slf4jLoggingEventListener implements KettleLoggingEventListener { @Override public void eventAdded( KettleLoggingEvent event ) { Object messageObject = event.getMessage(); checkNotNull( messageObject, "Expected log message to be defined." ); if ( messageObject instanceof LogMessage ) { LogMessage message = (LogMessage) messageObject; LoggingObjectInterface loggingObject = logObjProvider.apply( message.getLogChannelId() ); if ( loggingObject == null ) { logToLogger( diLogger, message.getLevel(), message.getSubject() + " " + message.getMessage() ); } else if ( loggingObject.getObjectType() == TRANS || loggingObject.getObjectType() == STEP || loggingObject.getObjectType() == DATABASE ) { logToLogger( transLogger, message.getLevel(), loggingObject, message ); } else if ( loggingObject.getObjectType() == JOB || loggingObject.getObjectType() == JOBENTRY ) { logToLogger( jobLogger, message.getLevel(), loggingObject, message ); } } } Slf4jLoggingEventListener(); }
Slf4jLoggingEventListener implements KettleLoggingEventListener { @Override public void eventAdded( KettleLoggingEvent event ) { Object messageObject = event.getMessage(); checkNotNull( messageObject, "Expected log message to be defined." ); if ( messageObject instanceof LogMessage ) { LogMessage message = (LogMessage) messageObject; LoggingObjectInterface loggingObject = logObjProvider.apply( message.getLogChannelId() ); if ( loggingObject == null ) { logToLogger( diLogger, message.getLevel(), message.getSubject() + " " + message.getMessage() ); } else if ( loggingObject.getObjectType() == TRANS || loggingObject.getObjectType() == STEP || loggingObject.getObjectType() == DATABASE ) { logToLogger( transLogger, message.getLevel(), loggingObject, message ); } else if ( loggingObject.getObjectType() == JOB || loggingObject.getObjectType() == JOBENTRY ) { logToLogger( jobLogger, message.getLevel(), loggingObject, message ); } } } Slf4jLoggingEventListener(); @Override void eventAdded( KettleLoggingEvent event ); }
Slf4jLoggingEventListener implements KettleLoggingEventListener { @Override public void eventAdded( KettleLoggingEvent event ) { Object messageObject = event.getMessage(); checkNotNull( messageObject, "Expected log message to be defined." ); if ( messageObject instanceof LogMessage ) { LogMessage message = (LogMessage) messageObject; LoggingObjectInterface loggingObject = logObjProvider.apply( message.getLogChannelId() ); if ( loggingObject == null ) { logToLogger( diLogger, message.getLevel(), message.getSubject() + " " + message.getMessage() ); } else if ( loggingObject.getObjectType() == TRANS || loggingObject.getObjectType() == STEP || loggingObject.getObjectType() == DATABASE ) { logToLogger( transLogger, message.getLevel(), loggingObject, message ); } else if ( loggingObject.getObjectType() == JOB || loggingObject.getObjectType() == JOBENTRY ) { logToLogger( jobLogger, message.getLevel(), loggingObject, message ); } } } Slf4jLoggingEventListener(); @Override void eventAdded( KettleLoggingEvent event );  }