Rhino extends the standard javax.slee.Tracer
interface with the com.opencloud.rhino.facilities.Tracer
interface, which adds additional functionality over what the JAIN SLEE specification provides.
Tracer interface
The com.opencloud.rhino.facilities.Tracer
extended tracer interface adds two new methods to the standard tracer.
Like all methods defined by the standard interface, both new methods are non-transactional; that is, they do not require an active transaction to return a successful result.
getParentTracer method
The getParentTracer
method returns a Tracer
object for the tracer’s parent tracer.
The parent tracer is the tracer with the name returned by the getParentTracerName
method defined in the standard Tracer
interface.
If this method is invoked on a Tracer
object for a root tracer, then null
is returned.
getChildTracer method
The getChildTracer
method returns a Tracer
object for a tracer that is a descendant (in terms of a parent-child relationship) of the invoked tracer.
The name
argument specifies the name of the child tracer.
Formally:
-
if the invoked tracer is a root tracer, then this method returns a tracer with the name specified by the
name
argument -
otherwise, this method returns a tracer with the name:
invokedTracer.getName()
+.
+name
.
The name
argument must be a valid tracer name.
Since any valid name can be specified, this method can be used to create any descendant tracer — child, grandchild, and so on.
This method throws a NullPointerException
if the name
argument is null
.
It throws an IllegalArgumentException
if the name
argument would result in an invalid tracer name.
It throws a javax.slee.facilities.FacilityException
if the child tracer cannot be returned because of a system-level failure.
Extended Tracer Interface
See the ExtendedTracer
interface Javadoc.
Rhino extensions to the SLEE-defined Tracer interface.
Since 2.6.0 Rhino tracer extensions support use of a string interpolation format that allows deferring final string construction until it is certain that the message will be logged somewhere.
Methods taking object parameters and a string message expect the string to use "{}" to mark object insertion points. Parameters will be inserted in argument order.
tracer.info("An {} string with {} object parameters", "example", 2);
will log "An example string with 2 object parameters".
Rhino tracer extensions were written to support garbage free tracing. To support that unrolled overloads for up to 10 object parameters are provided. More than 10 object parameters to these methods should be avoided as these are incompatible with garbage free tracing.
For situations where simple string interpolation is not sufficient, we offer the full flexibility of java.util.Formatter
string formatting
using the printf method.
MDC(Mapped Diagnostic Context) support was added in 2.6.0. This provides a mechanism to associate logging context with activities. associated context will be automatically included in every Trace/log message in {name=value, name=value} format. as a consequence of this, some care must be taken when deciding what to add as context to avoid overly long and unweildy log messages.
2017-11-29 12:18:42.236+1300 Fine [trace.HA_PingService.1_1.HA_PingSbb.1_1] <jr-19> {simpleRa connection=1, txID=101:211148435325409} START
Since Rhino 2.6.0 |