public void dispose() { KettleLogStore.getAppender().removeLoggingEventListener( this ); }
/** * Initialize the central log store with optional limitation to the size * * @param maxSize the maximum size * @param maxLogTimeoutHours The maximum time that a log line times out in hours. */ public static void init( int maxSize, int maxLogTimeoutMinutes ) { KettleLogStore.init( maxSize, maxLogTimeoutMinutes ); }
/** * Discard all the lines for the specified log channel id AND all the children. * * @param parentLogChannelId the parent log channel id to be removed along with all its children. */ public static void discardLines( String parentLogChannelId, boolean includeGeneralMessages ) { KettleLogStore.discardLines( parentLogChannelId, includeGeneralMessages ); } }
public void replaceLogCleaner( final int maxLogTimeoutMinutes ) { KettleLogStore.getInstance().replaceLogCleaner( maxLogTimeoutMinutes ); }
/** * Initialize the central log store with optional limitation to the size and redirect of stdout and stderr * * @param maxSize * the maximum size * @param maxLogTimeoutMinutes * the maximum time that a log line times out in hours * @param redirectStdOut * a boolean indicating whether to redirect stdout to the logging framework * @param redirectStdErr * a boolean indicating whether to redirect stderr to the logging framework */ public static void init( int maxSize, int maxLogTimeoutMinutes, boolean redirectStdOut, boolean redirectStdErr ) { if ( maxSize > 0 || maxLogTimeoutMinutes > 0 ) { init0( maxSize, maxLogTimeoutMinutes, redirectStdOut, redirectStdErr ); } else { init( redirectStdOut, redirectStdErr ); } }
public static void reset() { if ( KettleLogStore.isInitialized() ) { KettleLogStore.getInstance().reset(); } PluginRegistry.getInstance().reset(); initialized = null; } }
@GET @Path( "/log/{id : .+}/{logStart : .+}" ) @Produces( { MediaType.TEXT_PLAIN } ) public String getTransformationLog( @PathParam( "id" ) String id, @PathParam( "logStart" ) int startLineNr ) { int lastLineNr = KettleLogStore.getLastBufferLineNr(); Trans trans = CarteResource.getTransformation( id ); String logText = KettleLogStore.getAppender().getBuffer( trans.getLogChannel().getLogChannelId(), false, startLineNr, lastLineNr ).toString(); return logText; }
KettleLogStore.init(); KettleLogStore.getAppender().addLoggingEventListener( new ConsoleLoggingEventListener() ); KettleLogStore.getAppender().addLoggingEventListener( new Slf4jLoggingEventListener() );
} else { KettleLogStore.discardLines( trans.getLogChannelId(), true ); setDebugStatus( "Errors detected for mapper transformation" ); List<KettleLoggingEvent> logList = KettleLogStore .getLogBufferFromTo( trans.getLogChannelId(), false, 0, KettleLogStore.getLastBufferLineNr() );
trans.waitUntilFinished(); if ( trans.getErrors() > 0 ) { StringBuffer log = KettleLogStore.getAppender().getBuffer( trans.getLogChannelId(), false ); buffer.append( log ); KettleLogStore.discardLines( trans.getLogChannelId(), false ); LoggingRegistry.getInstance().removeIncludingChildren( trans.getLogChannelId() );
void cleanUp() { KettleClientEnvironment.reset(); PluginRegistry.getInstance().reset(); MetricsRegistry.getInstance().reset(); ExtensionPointMap.getInstance().reset(); if ( KettleLogStore.isInitialized() ) { KettleLogStore.getInstance().reset(); } KettleLogStore.setLogChannelInterfaceFactory( new LogChannelFactory() ); if ( Props.isInitialized() ) { Props.getInstance().reset(); } KettleVFS.getInstance().reset(); XMLHandlerCache.getInstance().clear(); ValueMetaFactory.pluginRegistry = PluginRegistry.getInstance(); // under no circumstance reset the LoggingRegistry // LoggingRegistry.getInstance().reset(); }
protected StaxPoiWorkbook() { openSheetsMap = new HashMap<String, StaxPoiSheet>(); this.log = KettleLogStore.getLogChannelInterfaceFactory().create( this ); }
@Before public void setUp() throws Exception { LogChannelInterfaceFactory logChannelInterfaceFactory = mock( LogChannelInterfaceFactory.class ); LogChannelInterface logChannelInterface = mock( LogChannelInterface.class ); oldLogChannelInterfaceFactory = KettleLogStore.getLogChannelInterfaceFactory(); KettleLogStore.setLogChannelInterfaceFactory( logChannelInterfaceFactory ); when( logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn( logChannelInterface ); }
@Override public void run() { for ( StepMetaDataCombi combi : trans.getSteps() ) { if ( combi.step.getErrors() > 0 ) { String channelId = combi.step.getLogChannel().getLogChannelId(); List<KettleLoggingEvent> eventList = KettleLogStore.getLogBufferFromTo( channelId, false, 0, KettleLogStore.getLastBufferLineNr() ); StringBuilder logText = new StringBuilder(); for ( KettleLoggingEvent event : eventList ) { Object message = event.getMessage(); if ( message instanceof LogMessage ) { LogMessage logMessage = (LogMessage) message; if ( logMessage.isError() ) { logText.append( logMessage.getMessage() ).append( Const.CR ); } } } stepLogMap.put( combi.stepMeta, logText.toString() ); } } } } );
/** * @return the number (sequence, 1..N) of the last log line. * If no records are present in the buffer, 0 is returned. */ public static int getLastBufferLineNr() { return KettleLogStore.getLastBufferLineNr(); }
/** * @return The appender that represents the central logging store. It is capable of giving back log rows in an * incremental fashion, etc. */ public static LoggingBuffer getAppender() { return getInstance().appender; }
/** * Get all the log lines for the specified parent log channel id (including all children) * * @param channelId channel IDs to grab * @param includeGeneral include general log lines * @param from * @param to * @return */ public static List<LoggingEvent> getLogBufferFromTo( List<String> channelId, boolean includeGeneral, int from, int to ) { return convertKettleLoggingEventsToLog4jLoggingEvents( KettleLogStore.getLogBufferFromTo( channelId, includeGeneral, from, to ) ); }
/** * Initialize the central log store. If it has already been initialized the configuration will be updated. * * @param maxSize * the maximum size of the log buffer * @param maxLogTimeoutMinutes * The maximum time that a log line times out in minutes */ private static synchronized void init0( int maxSize, int maxLogTimeoutMinutes, boolean redirectStdOut, boolean redirectStdErr ) { if ( store != null ) { // CentralLogStore already initialized. Just update the values. store.appender.setMaxNrLines( maxSize ); store.replaceLogCleaner( maxLogTimeoutMinutes ); } else { store = new KettleLogStore( maxSize, maxLogTimeoutMinutes, redirectStdOut, redirectStdErr ); } initialized.set( true ); }
/** * Create the central log store with optional limitation to the size * * @param maxSize * the maximum size * @param maxLogTimeoutMinutes * The maximum time that a log line times out in Minutes. */ private KettleLogStore( int maxSize, int maxLogTimeoutMinutes, boolean redirectStdOut, boolean redirectStdErr ) { this.appender = new LoggingBuffer( maxSize ); replaceLogCleaner( maxLogTimeoutMinutes ); if ( redirectStdOut ) { System.setOut( new LoggingPrintStream( OriginalSystemOut ) ); } if ( redirectStdErr ) { System.setErr( new LoggingPrintStream( OriginalSystemErr ) ); } }
+ className + " registered for plugin type '" + pluginType.getName() + "'" ); } else { if ( KettleLogStore.isInitialized() && LogChannel.GENERAL.isDebug() ) { LogChannel.GENERAL.logDebug( "Plugin class " + className + " doesn't contain annotation for plugin type '" + pluginType.getName() + "'" ); if ( KettleLogStore.isInitialized() && LogChannel.GENERAL.isDebug() ) { LogChannel.GENERAL.logDebug( "Plugin class " + className + " doesn't contain valid class for plugin type '" + pluginType.getName() + "'" ); if ( KettleLogStore.isInitialized() ) { LogChannel.GENERAL.logError( "Error registring plugin class from KETTLE_PLUGIN_CLASSES: " + className + Const.CR + Const.getStackTracker( e ) );