Class LogTracer

java.lang.Object
org.pipservices3.components.trace.LogTracer
All Implemented Interfaces:
org.pipservices3.commons.config.IConfigurable, org.pipservices3.commons.refer.IReferenceable, ITracer

public class LogTracer extends Object implements org.pipservices3.commons.config.IConfigurable, org.pipservices3.commons.refer.IReferenceable, ITracer
Tracer that dumps recorded traces to logger. ### Configuration parameters ###
  • - options:
    • - log_level: log level to record traces (default: debug)
### References ###
  • *:logger:*:*:1.0 (optional) ILogger components to dump the captured counters
  • *:context-info:*:*:1.0 (optional) ContextInfo to detect the context id and specify counters source
See Also:
  • Constructor Details

    • LogTracer

      public LogTracer()
  • Method Details

    • configure

      public void configure(org.pipservices3.commons.config.ConfigParams config) throws org.pipservices3.commons.errors.ConfigException
      Configures component by passing configuration parameters.
      Specified by:
      configure in interface org.pipservices3.commons.config.IConfigurable
      Parameters:
      config - configuration parameters to be set.
      Throws:
      org.pipservices3.commons.errors.ConfigException
    • setReferences

      public void setReferences(org.pipservices3.commons.refer.IReferences references)
      Sets references to dependent components.
      Specified by:
      setReferences in interface org.pipservices3.commons.refer.IReferenceable
      Parameters:
      references - references to locate the component dependencies.
      Throws:
      org.pipservices3.commons.refer.ReferenceException
      org.pipservices3.commons.errors.ConfigException
    • trace

      public void trace(String correlationId, String component, String operation, Long duration)
      Records an operation trace with its name and duration
      Specified by:
      trace in interface ITracer
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      component - a name of called component
      operation - a name of the executed operation.
      duration - execution duration in milliseconds.
    • failure

      public void failure(String correlationId, String component, String operation, Exception error, long duration)
      Records an operation failure with its name, duration and error
      Specified by:
      failure in interface ITracer
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      component - a name of called component
      operation - a name of the executed operation.
      error - an error object associated with this trace.
      duration - execution duration in milliseconds.
    • beginTrace

      public TraceTiming beginTrace(String correlationId, String component, String operation)
      Begings recording an operation trace
      Specified by:
      beginTrace in interface ITracer
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      component - a name of called component
      operation - a name of the executed operation.