public class FileTracer extends AbstractTracer
AbstractTracer.Exception| Modifier and Type | Field and Description |
|---|---|
protected long |
byteLimit
indicates the lower bound of the number of bytes which leads to a log file rotation
|
protected int |
counter
counts the number of file splittings
|
protected FileOutputStream |
fileOutputStream
the underlying OutputStream
|
protected Path |
logDirPath
denotes default log directory
|
protected File |
traceLogfile
the actual log file
|
VERSION| Constructor and Description |
|---|
FileTracer(String name)
Constructor expects the preferably unique tracer name.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkLimit()
Checks if the file size limit has been exceeded and splits the trace file if need be.
|
void |
close()
Closes the associated trace streams.
|
long |
getByteLimit()
Indicates the lower bound of the number of bytes which leads to a log file rotation.
|
Path |
getLogDirPath()
Gives the path to the directory of the logfile.
|
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()
Creates the underlying trace file and opens the associated trace 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 |
setByteLimit(long byteLimit)
Sets the lower bound of the number of bytes which leads to a log file rotation.
|
void |
setLogDirPath(Path logDirPath)
Sets the path to the directory of the logfile.
|
clearCurrentTracingContext, entry, entry, entry, formatStreamErrorState, formatVersionInfo, getBufferedOutputStream, getBufferSize, getName, getNullPrintStream, getSyncObject, getThreadMap, getTracePrintStream, initCurrentTracingContext, initCurrentTracingContext, isAutoflush, isOpened, out, setAutoflush, setBufferedOutputStream, setBufferSize, setOpened, setTracePrintStream, substitute, wayoutprotected File traceLogfile
protected FileOutputStream fileOutputStream
protected volatile long byteLimit
protected Path logDirPath
protected int counter
public FileTracer(String name)
name - the name of the tracerpublic Path getLogDirPath()
public void setLogDirPath(Path logDirPath)
logDirPath - the logDirPath to setpublic long getByteLimit()
public void setByteLimit(long byteLimit)
byteLimit - the byteLimit to setpublic void open()
open in class AbstractTracerpublic void close()
close in class AbstractTracerprotected 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 instancesprotected void checkLimit()
public 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 AbstractTracerIndentablePrintStreampublic 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 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 methodCopyright © 2014. All rights reserved.