public class TraceSystem extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ADAPTER
This trace level means all type of messages should be written, but
instead of using the trace file the messages should be written to SLF4J.
|
static int |
DEBUG
This trace level means all type of messages should be written.
|
static int |
DEFAULT_TRACE_LEVEL_FILE
The default level for file trace messages.
|
static int |
DEFAULT_TRACE_LEVEL_SYSTEM_OUT
The default level for system out trace messages.
|
static int |
ERROR
This trace level means only errors should be written.
|
static int |
INFO
This trace level means errors and informational messages should be
written.
|
static int |
OFF
This trace level means nothing should be written.
|
static int |
PARENT
The parent trace level should be used.
|
Constructor and Description |
---|
TraceSystem(String fileName)
Create a new trace system object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the writers, and the files if required.
|
int |
getLevelFile() |
Trace |
getTrace(String module)
Get or create a trace object for this module.
|
boolean |
isEnabled(int level)
Check the given trace / log level is enabled.
|
void |
setFileName(String name)
Set the trace file name.
|
void |
setLevelFile(int level)
Set the file trace level.
|
void |
setLevelSystemOut(int level)
Set the trace level to use for System.out
|
void |
setMaxFileSize(int max)
Set the maximum trace file size in bytes.
|
void |
setName(String name)
Set the name of the database or trace object.
|
void |
setSysOut(PrintStream out)
Set the print stream to use instead of System.out.
|
static void |
traceThrowable(Throwable e)
Write the exception to the driver manager log writer if configured.
|
void |
write(int level,
String module,
String s,
Throwable t)
Write a message.
|
public static final int PARENT
public static final int OFF
public static final int ERROR
public static final int INFO
public static final int DEBUG
public static final int ADAPTER
public static final int DEFAULT_TRACE_LEVEL_SYSTEM_OUT
public static final int DEFAULT_TRACE_LEVEL_FILE
public TraceSystem(String fileName)
fileName
- the file namepublic void setSysOut(PrintStream out)
out
- the new print streampublic static void traceThrowable(Throwable e)
e
- the exceptionpublic Trace getTrace(String module)
module
- the module namepublic boolean isEnabled(int level)
level
- the levelpublic void setFileName(String name)
name
- the file namepublic void setMaxFileSize(int max)
max
- the maximum sizepublic void setLevelSystemOut(int level)
level
- the new levelpublic void setLevelFile(int level)
level
- the new levelpublic int getLevelFile()
public void write(int level, String module, String s, Throwable t)
level
- the trace levelmodule
- the name of the modules
- the messaget
- the exception (may be null)public void close()
public void setName(String name)
name
- the new nameCopyright © 2012 JBoss by Red Hat. All Rights Reserved.