public String dump( boolean includeGeneral ) { StringBuilder out = new StringBuilder( 50000 ); for ( LoggingObjectInterface o : this.map.values() ) { if ( ( includeGeneral ) || ( !o.getObjectType().equals( LoggingObjectType.GENERAL ) ) ) { out.append( o.getContainerObjectId() ); out.append( "\t" ); out.append( o.getLogChannelId() ); out.append( "\t" ); out.append( o.getObjectType().name() ); out.append( "\t" ); out.append( o.getObjectName() ); out.append( "\t" ); out.append( o.getParent() != null ? o.getParent().getLogChannelId() : "-" ); out.append( "\t" ); out.append( o.getParent() != null ? o.getParent().getObjectType().name() : "-" ); out.append( "\t" ); out.append( o.getParent() != null ? o.getParent().getObjectName() : "-" ); out.append( "\n" ); } } return out.toString(); }
private void grabLoggingObjectInformation( LoggingObjectInterface loggingObject ) { objectType = loggingObject.getObjectType(); objectName = loggingObject.getObjectName(); repositoryDirectory = loggingObject.getRepositoryDirectory(); filename = loggingObject.getFilename(); objectId = loggingObject.getObjectId(); objectRevision = loggingObject.getObjectRevision(); objectCopy = loggingObject.getObjectCopy(); logLevel = loggingObject.getLogLevel(); containerObjectId = loggingObject.getContainerObjectId(); forcingSeparateLogging = loggingObject.isForcingSeparateLogging(); gatheringMetrics = loggingObject.isGatheringMetrics(); if ( loggingObject.getParent() != null ) { getParentLoggingObject( loggingObject.getParent() ); // inherit the containerObjectId from parent containerObjectId = loggingObject.getParent().getContainerObjectId(); } }
/** * @param loggingObject */ private List<String> getSubjectTree( LoggingObjectInterface loggingObject ) { List<String> subjects = new ArrayList<String>(); while ( loggingObject != null ) { subjects.add( loggingObject.getObjectName() ); loggingObject = loggingObject.getParent(); } return subjects; }
public void dumpLoggingRegistry() { LoggingRegistry registry = LoggingRegistry.getInstance(); Map<String, LoggingObjectInterface> loggingMap = registry.getMap(); for ( LoggingObjectInterface loggingObject : loggingMap.values() ) { System.out.println( loggingObject.getLogChannelId() + " - " + loggingObject.getObjectName() + " - " + loggingObject.getObjectType() ); } }
break; case CHANNEL_ID: value = loggingObject.getLogChannelId(); break; case LOG_DATE: break; case LOGGING_OBJECT_TYPE: value = loggingObject.getObjectType().toString(); break; case OBJECT_NAME: value = loggingObject.getObjectName(); break; case OBJECT_COPY: value = loggingObject.getObjectCopy(); break; case REPOSITORY_DIRECTORY: value = loggingObject.getRepositoryDirectory() == null ? null : loggingObject .getRepositoryDirectory().getPath(); break; case FILENAME: value = loggingObject.getFilename(); break; case OBJECT_ID: value = loggingObject.getObjectId() == null ? null : loggingObject.getObjectId().toString(); break; case OBJECT_REVISION: value =
private String getDetailedSubject( LoggingObjectInterface loggingObject ) { LinkedList<String> subjects = new LinkedList<>(); while ( loggingObject != null ) { if ( loggingObject.getObjectType() == TRANS || loggingObject.getObjectType() == JOB ) { RepositoryDirectoryInterface rd = loggingObject.getRepositoryDirectory(); String filename = loggingObject.getFilename(); if ( rd != null ) { String path = rd.getPath(); if ( path.equals( SEPARATOR ) ) { if ( filename != null && filename.length() > 0 ) { subjects.add( filename ); } } else { subjects.add( path + SEPARATOR + filename ); } } else if ( filename != null && filename.length() > 0 ) { subjects.add( filename ); } } loggingObject = loggingObject.getParent(); } if ( subjects.size() > 0 ) { return subjects.size() > 1 ? formatDetailedSubject( subjects ) : subjects.get( 0 ); } else { return ""; } }
@Override public String toString() { LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( logChannelId ); String subject = null; if ( loggingObject != null ) { subject = loggingObject.getObjectName() + "(" + loggingObject.getObjectType() + ")"; } else { subject = "-"; } return subject + " - " + getKey() + " @ " + StringUtil.getFormattedDateTime( date, true ) + " : " + type.toString(); }
LoggingObjectInterface foundParent = found.getParent(); LoggingObjectInterface loggingSourceParent = loggingSource.getParent(); String foundLogChannelId = found.getLogChannelId(); if ( foundParent != null && loggingSourceParent != null ) { String foundParentLogChannelId = foundParent.getLogChannelId(); String sourceParentLogChannelId = loggingSourceParent.getLogChannelId(); if ( foundParentLogChannelId != null && sourceParentLogChannelId != null && foundParentLogChannelId.equals( sourceParentLogChannelId ) ) { String parentLogChannelId = loggingSource.getParent().getLogChannelId(); if ( parentLogChannelId != null ) { List<String> parentChildren = for ( int i = 0; i < cutCount; i++ ) { LoggingObjectInterface toRemove = all.get( i ); if ( !channelsNotToRemove.contains( toRemove.getLogChannelId() ) ) { this.map.remove( toRemove.getLogChannelId() );
private void lookupSubject() { // Derive the subject from the registry // LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( logChannelId ); boolean detailedLogTurnOn = "Y".equals( EnvUtil.getSystemProperty( Const.KETTLE_LOG_MARK_MAPPINGS ) ) ? true : false; if ( loggingObject != null ) { if ( !detailedLogTurnOn ) { subject = loggingObject.getObjectName(); } else { subject = getDetailedSubject( loggingObject ); } copy = loggingObject.getObjectCopy(); } }
private boolean isGeneral( String logChannelId ) { LoggingObjectInterface loggingObject = loggingRegistry.getLoggingObject( logChannelId ); return loggingObject != null && LoggingObjectType.GENERAL.equals( loggingObject.getObjectType() ); }
if ( parent.getLogChannelId() != null ) { LoggingObjectInterface parentLoggingObject = LoggingRegistry.getInstance().getLoggingObject( parent.getLogChannelId() ); if ( parentLoggingObject != null ) { parent = parentLoggingObject;
private void drawDurations( List<MetricsDuration> durations, List<MetricsDrawArea> areas, double pixelsPerMs ) { // set top indent int y = 20; for ( MetricsDuration duration : durations ) { Long realDuration = duration.getEndDate().getTime() - duration.getDate().getTime(); // How many pixels does it take to drawn this duration? // int durationWidth = (int) ( realDuration * pixelsPerMs ); int x = 2 + (int) ( ( duration.getDate().getTime() - periodStart ) * pixelsPerMs ); getGc().setBackground( EColor.BACKGROUND ); getGc().setForeground( EColor.LIGHTBLUE ); getGc().fillGradientRectangle( x, y, durationWidth, barHeight, false ); getGc().setForeground( EColor.BLACK ); getGc().drawRectangle( x, y, durationWidth, barHeight ); areas.add( new MetricsDrawArea( new Rectangle( x, y, durationWidth, barHeight ), duration ) ); LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( duration.getLogChannelId() ); String message = duration.getDescription() + " - " + loggingObject.getObjectName() + " : " + duration.getDuration() + "ms"; if ( duration.getCount() > 1 ) { message += " " + duration.getCount() + " calls, avg=" + ( duration.getDuration() / duration.getCount() ); } getGc().setFont( EFont.GRAPH ); getGc().textExtent( message ); getGc().drawText( message, x + 3, y + 4, true ); y += barHeight + 5; } }
@Override public void mouseDown( MouseEvent event ) { if ( drawAreas == null ) { return; } for ( int i = drawAreas.size() - 1; i >= 0; i-- ) { MetricsDrawArea drawArea = drawAreas.get( i ); if ( drawArea.getArea().contains( event.x, event.y ) ) { MetricsDuration duration = drawArea.getDuration(); if ( duration == null ) { continue; } System.out.println( duration.toString() ); LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( duration.getLogChannelId() ); if ( loggingObject == null ) { continue; } System.out.println( loggingObject.getObjectType() + " : " + loggingObject.getObjectName() ); } } } } );
String parentLogChannelId = loggingObject.getParent().getLogChannelId(); List<String> logChannelChildren = LoggingRegistry.getInstance().getLogChannelChildren( parentLogChannelId ); int childIndex = Const.indexOfString( log.getLogChannelId(), logChannelChildren );
@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 ) { // this can happen if logObject has been discarded while log events are still in flight. 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 ); } } }
@Override public void mouseDown( MouseEvent event ) { if ( drawAreas == null ) { return; } for ( int i = drawAreas.size() - 1; i >= 0; i-- ) { MetricsDrawArea drawArea = drawAreas.get( i ); if ( drawArea.getArea().contains( event.x, event.y ) ) { MetricsDuration duration = drawArea.getDuration(); if ( duration == null ) { continue; } System.out.println( duration.toString() ); LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( duration.getLogChannelId() ); if ( loggingObject == null ) { return; } System.out.println( loggingObject.getObjectType() + " : " + loggingObject.getObjectName() ); } } } } );