/** * Gets the logging channel id * * @return the log channel id * @see org.pentaho.di.core.logging.LoggingObjectInterface#getLogChannelId() */ @Override public String getLogChannelId() { return log.getLogChannelId(); }
@Override public String getLogChannelId() { return log.getLogChannelId(); }
/** * Gets the log channel id. * * @return the logChannelId */ public String getLogChannelId() { return log.getLogChannelId(); }
/** * Gets the log channel ID. * * @return the log channel ID * @see org.pentaho.di.core.logging.LoggingObjectInterface#getLogChannelId() */ @Override public String getLogChannelId() { return log.getLogChannelId(); }
/** * Gets the log channel ID. * * @return the log channel ID * @see org.pentaho.di.core.logging.LoggingObjectInterface#getLogChannelId() */ @Override public String getLogChannelId() { return log.getLogChannelId(); }
@Override public String getLogChannelId() { return log.getLogChannelId(); }
@Override public String getLogChannelId() { return writerLog.getLogChannelId(); }
@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; }
@GET @Path( "/log/{id : .+}/{logStart : .+}" ) @Produces( { MediaType.TEXT_PLAIN } ) public String getJobLog( @PathParam( "id" ) String id, @PathParam( "logStart" ) int startLineNr ) { int lastLineNr = KettleLogStore.getLastBufferLineNr(); Job job = CarteResource.getJob( id ); String logText = KettleLogStore.getAppender().getBuffer( job.getLogChannel().getLogChannelId(), false, startLineNr, lastLineNr ).toString(); return logText; }
private String getLogText( Trans trans, int startLineNr, int lastLineNr ) throws KettleException { try { return KettleLogStore.getAppender().getBuffer( trans.getLogChannel().getLogChannelId(), false, startLineNr, lastLineNr ).toString(); } catch ( OutOfMemoryError error ) { throw new KettleException( "Log string is too long", error ); } }
private String getLogText( Job job, int startLineNr, int lastLineNr ) throws KettleException { try { return KettleLogStore.getAppender().getBuffer( job.getLogChannel().getLogChannelId(), false, startLineNr, lastLineNr ).toString(); } catch ( OutOfMemoryError error ) { throw new KettleException( "Log string is too long" ); } } }
/** * PDI-10762 - Trans and TransMeta leak */ @Test public void testLoggingObjectIsNotLeakInMeta() { String expected = meta.log.getLogChannelId(); meta.clear(); String actual = meta.log.getLogChannelId(); assertEquals( "Use same logChannel for empty constructors, or assign General level for clear() calls", expected, actual ); }
public void addSnapshot( LogChannelInterface logChannel, MetricsSnapshotInterface snapshot ) { MetricsInterface metric = snapshot.getMetric(); String channelId = logChannel.getLogChannelId(); switch ( metric.getType() ) { case START: case STOP: Queue<MetricsSnapshotInterface> list = getSnapshotList( channelId ); list.add( snapshot ); break; case MIN: case MAX: case SUM: case COUNT: Map<String, MetricsSnapshotInterface> map = getSnapshotMap( channelId ); map.put( snapshot.getKey(), snapshot ); break; default: break; } }
@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() ); } } } } );
@Override public void transFinished( Trans trans ) throws KettleException { // Copy over the data from the previewDelegate... // if ( trans.getErrors() != 0 ) { // capture logging and store it... // for ( StepMetaDataCombi combi : trans.getSteps() ) { if ( combi.copy == 0 ) { StringBuffer logBuffer = KettleLogStore.getAppender().getBuffer( combi.step.getLogChannel().getLogChannelId(), false ); previewLogMap.put( combi.stepMeta, logBuffer ); } } } } } );
/** * PDI-10762 - Trans and TransMeta leak */ @Test public void testLoggingObjectIsNotLeakInTrans() throws KettleException { Repository rep = Mockito.mock( Repository.class ); RepositoryDirectoryInterface repInt = Mockito.mock( RepositoryDirectoryInterface.class ); Mockito.when( rep.loadTransformation( Mockito.anyString(), Mockito.any( RepositoryDirectoryInterface.class ), Mockito .any( ProgressMonitorListener.class ), Mockito.anyBoolean(), Mockito.anyString() ) ).thenReturn( meta ); Mockito.when( rep.findDirectory( Mockito.anyString() ) ).thenReturn( repInt ); Trans trans = new Trans( meta, rep, "junit", "junitDir", "fileName" ); assertEquals( "Log channel General assigned", LogChannel.GENERAL.getLogChannelId(), trans.log .getLogChannelId() ); }
/** * @deprecated use {@link #JobEntryResult(Result, String, String, String, String, int, String)} * * @param result * @param comment * @param reason * @param copy */ @Deprecated public JobEntryResult( Result result, String comment, String reason, JobEntryCopy copy ) { this( result, copy.getEntry().getLogChannel().getLogChannelId(), comment, reason, copy != null ? copy .getName() : null, copy != null ? copy.getNr() : 0, copy == null ? null : ( copy.getEntry() != null ? copy .getEntry().getFilename() : null ) ); }
protected synchronized void writeMetricsInformation() throws KettleException { Preconditions.checkNotNull( log ); List<MetricsDuration> metricsList = MetricsUtil.getDuration( log.getLogChannelId(), Metrics.METRIC_PLUGIN_REGISTRY_REGISTER_EXTENSIONS_START ); if ( ( log.isDebug() ) && !metricsList.isEmpty() ) { log.logDebug( metricsList.get( 0 ).toString() ); MetricsUtil.getDuration( log.getLogChannelId(), Metrics.METRIC_PLUGIN_REGISTRY_PLUGIN_REGISTRATION_START ); if ( ( log != null ) && ( log.isDebug() ) && !metricsList.isEmpty() ) { log.logDebug( metricsList.get( 0 ).toString() ); MetricsUtil.getDuration( log.getLogChannelId(), Metrics.METRIC_PLUGIN_REGISTRY_PLUGIN_TYPE_REGISTRATION_START ); if ( ( log != null ) && ( log.isDebug() ) && metricsList != null && !metricsList.isEmpty() ) { for ( MetricsDuration duration : metricsList ) {
String logChannelId = log.getLogChannelId(); LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( logChannelId ); String parentLogChannelId = loggingObject.getParent().getLogChannelId(); List<String> logChannelChildren = LoggingRegistry.getInstance().getLogChannelChildren( parentLogChannelId ); int childIndex = Const.indexOfString( log.getLogChannelId(), logChannelChildren ); if ( log.isDebug() ) { log.logDebug( "child index = " + childIndex + ", logging object : " + loggingObject.toString() + " parent=" + parentLogChannelId );
result.setLogChannelId( log.getLogChannelId() );