protected String getFilterString() { String string = filter.toString(); if( filter instanceof Traceable ) string += " @ " + ( (Traceable) filter ).getTrace(); return string; }
private static String formatTrace( Traceable traceable, String message, TraceFormatter formatter ) { if( traceable == null ) return message; String trace = traceable.getTrace(); if( trace == null ) return message; return formatter.format( trace ) + " " + message; }
public TrapHandler( FlowProcess flowProcess, FlowElement flowElement, Tap trap, String trapName ) { this.flowProcess = flowProcess; this.flowElement = flowElement; this.trap = trap; this.trapName = trapName; if( flowElement instanceof Traceable ) this.elementTrace = ( (Traceable) flowElement ).getTrace(); else this.elementTrace = null; this.recordElementTrace = flowProcess.getBooleanProperty( TrapProps.RECORD_ELEMENT_TRACE, this.recordElementTrace ); this.recordThrowableMessage = flowProcess.getBooleanProperty( TrapProps.RECORD_THROWABLE_MESSAGE, this.recordThrowableMessage ); this.recordThrowableStackTrace = flowProcess.getBooleanProperty( TrapProps.RECORD_THROWABLE_STACK_TRACE, this.recordThrowableStackTrace ); this.logThrowableStackTrace = flowProcess.getBooleanProperty( TrapProps.LOG_THROWABLE_STACK_TRACE, this.logThrowableStackTrace ); this.stackTraceLineDelimiter = flowProcess.getStringProperty( TrapProps.STACK_TRACE_LINE_DELIMITER, this.stackTraceLineDelimiter ); this.stackTraceTrimLine = flowProcess.getBooleanProperty( TrapProps.STACK_TRACE_LINE_TRIM, this.stackTraceTrimLine ); this.recordAnyDiagnostics = this.recordElementTrace || this.recordThrowableMessage || this.recordThrowableStackTrace; Fields fields = new Fields(); if( this.recordElementTrace ) fields = fields.append( new Fields( "element-trace" ) ); if( this.recordThrowableMessage ) fields = fields.append( new Fields( "throwable-message" ) ); if( this.recordThrowableStackTrace ) fields = fields.append( new Fields( "throwable-stacktrace" ) ); if( fields.size() != 0 ) this.diagnosticFields = fields; this.diagnosticEntry = new TupleEntry( diagnosticFields ); }