T - The actual tracer typepublic abstract class DebugLogTee<T extends AbstractTracer> extends AbstractTracer
AbstractTracer base class but does so by wrapping and delegating to another AbstractTracer.
Besides two abstract adapt methods must be implemented to route log messages to the desired log system. Note that the wrapped tracer instance must
not be a NullTracer. An adapter which is only interested in logging messages and wants to discard the additional tracing information altogether
should be derived directly from the NullTracer.AbstractTracer.Exception| Modifier and Type | Field and Description |
|---|---|
protected T |
tracer
Some tracer.
|
VERSION| Constructor and Description |
|---|
DebugLogTee(String name,
T tracer)
Constructor expects the name of the tracer and the to be wrapped Tracer instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
adapt(LogLevel logLevel,
String message,
Class clazz)
Derived classes should provide code which routes the given message with the denoted logLevel and class to the desired log system.
|
protected abstract void |
adapt(LogLevel logLevel,
Throwable throwable,
Class clazz)
Derived classes should provide code which routes the given throwable with the denoted logLevel and class to the desired log system.
|
void |
close()
Derived classes should provide code that closes the output streams.
|
TraceMethod |
entry(String methodSignature)
Deprecated.
|
TraceMethod |
entry(String returnType,
Class clazz,
String methodSignature)
Indicates an entering of a method which belongs to a class.
|
TraceMethod |
entry(String returnType,
Object object,
String methodSignature)
Indicates an entering of a method which belongs to an object.
|
int |
getBufferSize()
Gives the buffer size of the actual
TracePrintStream. |
String |
getName()
The name of the tracer.
|
Object |
getSyncObject()
Synchronizes access to the
TracePrintStream. |
void |
initCurrentTracingContext()
Initialises the current tracing context by taking the values for debugLevel and online from the configured
debug map.
|
void |
initCurrentTracingContext(int debugLevel,
boolean online)
Initialises the current tracing context with the given debugLevel and online state.
|
boolean |
isAutoflush()
Indicates whether the output stream will be flushed when leaving a
method by
AbstractTracer.wayout(). |
boolean |
isOpened()
Indicates whether the actual
TracePrintStream is opened. |
void |
logException(LogLevel logLevel,
Throwable throwable,
Class clazz,
String methodName)
Logs an exception with the given logLevel and the originating class.
|
void |
logMessage(LogLevel logLevel,
String message,
Class clazz,
String methodName)
Logs a message with the given logLevel and the originating class.
|
void |
open()
Derived classes should provide code that opens the respective output streams.
|
IndentablePrintStream |
out()
Returns some kind of an
IndentablePrintStream based upon the the current managed stack size, the configured debug
level and the online state of the current tracing context. |
protected void |
readConfiguration(XPath xpath,
Node node)
Reads the configuration for this particular tracer instance by evaluating the given node with the given xpath engine.
|
void |
setAutoflush(boolean autoflush)
Used during the configuration.
|
void |
setBufferSize(int bufferSize)
Configures the buffer size of the actual
TracePrintStream. |
TraceMethod |
wayout()
Indicates the exiting of a method.
|
clearCurrentTracingContext, formatStreamErrorState, formatVersionInfo, getBufferedOutputStream, getNullPrintStream, getThreadMap, getTracePrintStream, out, setBufferedOutputStream, setOpened, setTracePrintStream, substituteprotected final T extends AbstractTracer tracer
public final Object getSyncObject()
AbstractTracerTracePrintStream. Clients with multiple TracingContexts should use it to synchronize their access to
AbstractTracer.out().getSyncObject in class AbstractTracerpublic final int getBufferSize()
AbstractTracerTracePrintStream.getBufferSize in class AbstractTracerpublic final boolean isAutoflush()
AbstractTracerAbstractTracer.wayout().isAutoflush in class AbstractTracerpublic final boolean isOpened()
AbstractTracerTracePrintStream is opened.isOpened in class AbstractTracerpublic final String getName()
AbstractTracergetName in class AbstractTracerpublic final void setBufferSize(int bufferSize)
AbstractTracerTracePrintStream.setBufferSize in class AbstractTracerbufferSize - the bufferSize to setpublic final void setAutoflush(boolean autoflush)
AbstractTracerAbstractTracer.wayout().setAutoflush in class AbstractTracerautoflush - the autoflush to setprotected final void readConfiguration(XPath xpath, Node node) throws XPathExpressionException, AbstractTracer.Exception
AbstractTracerreadConfiguration in class AbstractTracerxpath - the xpath enginenode - the config nodeXPathExpressionException - indicates xpath problemsAbstractTracer.Exception - indicates problems when configuring certain tracer instancespublic void open()
AbstractTraceropen in class AbstractTracerpublic void close()
AbstractTracerclose in class AbstractTracerpublic final void initCurrentTracingContext()
AbstractTracerinitCurrentTracingContext in class AbstractTracerpublic final void initCurrentTracingContext(int debugLevel,
boolean online)
AbstractTracerinitCurrentTracingContext in class AbstractTracerdebugLevel - controls the extent of the outputonline - a value of false delivers no output of the current thread at all whereas a value of true delivers output controlled by debugLevelprotected abstract void adapt(LogLevel logLevel, String message, Class clazz)
logLevel - the to be translated LogLevelmessage - the actual messageclazz - the class context of the messageprotected abstract void adapt(LogLevel logLevel, Throwable throwable, Class clazz)
logLevel - the to be translated LogLevelthrowable - references the to be logged infoclazz - the class context of the messagepublic TraceMethod entry(String returnType, Class clazz, String methodSignature)
AbstractTracerTracingContext exists for the current thread a TraceMethod object
will be created and thereupon pushed onto the stack of a ThreadMap.entry in class AbstractTracerreturnType - the return type of the method as string representationclazz - the class to which that method belongmethodSignature - the remaining method signature (without return type) inclusive parameter as string representationpublic TraceMethod entry(String returnType, Object object, String methodSignature)
AbstractTracerTracingContext exists for the current thread a TraceMethod object
will be created and thereupon pushed onto the stack of a ThreadMap.entry in class AbstractTracerreturnType - the return type of the method as string representationobject - the object that owns the methodmethodSignature - the remaining method signature (without return type) inclusive parameter as string representation@Deprecated public TraceMethod entry(String methodSignature)
AbstractTracerentry in class AbstractTracermethodSignature - the signature of the method as string representationpublic final void logMessage(LogLevel logLevel, String message, Class clazz, String methodName)
AbstractTracerlogMessage in class AbstractTracerlogLevel - one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVEREmessage - the to be logged messageclazz - the originating classmethodName - the originating methodpublic final void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName)
AbstractTracerlogException in class AbstractTracerlogLevel - one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVEREthrowable - the to be logged throwableclazz - the originating classmethodName - the name of the relevant methodpublic TraceMethod wayout()
AbstractTracerwayout in class AbstractTracerpublic final IndentablePrintStream out()
AbstractTracerIndentablePrintStream based upon the the current managed stack size, the configured debug
level and the online state of the current tracing context. This is the NullPrintStream if the stack size is greater
than the debug level or if the thread is offline. Otherwise it's the TracePrintStream.out in class AbstractTracerIndentablePrintStreamCopyright © 2014. All rights reserved.