public class FileTraceImpl
extends java.lang.Object
com.novell.nds.dirxml.driver.TraceInterface
that
can be registered with the com.novell.nds.dirxml.driver.Trace
class.
Trace messages are output to a file specified via the setFile()
method.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
DEFAULT_TIME_FORMAT
Default timestamp formatting string to use: "[MM/dd/yy HH:mm:ss.SS]: "
|
protected static LocalizedMessageSource |
messageSource
Source of localized message strings
|
protected static java.io.PrintStream |
printStream |
protected static java.lang.String |
TAB
String used for indenting XML documents
|
protected static java.text.SimpleDateFormat |
timeFormat
Time formatter for timestamps.
|
protected static java.lang.String |
timeFormatString
Time format string for timestamps.
|
protected static java.lang.String |
TRACE_TIMEFORMAT |
protected static int |
traceLevel |
Constructor and Description |
---|
FileTraceImpl()
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getLevel()
Return the current trace level.
|
static void |
setFile(java.io.File file)
Set the file to use for this class.
|
static void |
setFile(java.lang.String filename)
Set the file name to use for this class.
|
static void |
setLevel(int newLevel)
Set the trace level for this class.
|
protected static java.lang.String |
timeStampMessage(java.lang.String message)
Prepend a timestamp to a String and return the result.
|
void |
trace(int color,
int level,
java.lang.String message)
Output a message string if the passed level is
greater than or equal to the current trace level.
|
void |
trace(int level,
java.lang.String message)
Output a message string if the passed level is
greater than or equal to the current trace level.
|
void |
trace(int level,
XmlDocument document)
Serialize and output XML document if passed level
is greater than or equal to the current trace level.
|
protected void |
traceAlways(org.w3c.dom.Document document)
Output an XML
Document regardless of level |
protected void |
traceAlways(java.lang.String message)
Output a message regardless of level.
|
protected static java.io.PrintStream printStream
protected static int traceLevel
protected static final java.lang.String TAB
protected static LocalizedMessageSource messageSource
protected static java.lang.String timeFormatString
protected static java.text.SimpleDateFormat timeFormat
protected static final java.lang.String DEFAULT_TIME_FORMAT
protected static final java.lang.String TRACE_TIMEFORMAT
public FileTraceImpl()
com.novell.nds.dirxml.driver.Trace
class.public static void setFile(java.io.File file) throws java.io.IOException
com.novell.nds.dirxml.driver.Trace
class creates an instance
of this class.file
- File
to receive trace informationjava.io.IOException
- if an error occurs opening the filepublic static void setFile(java.lang.String filename) throws java.io.IOException
com.novell.nds.dirxml.driver.Trace
class creates an instance
of this class.filename
- name of file to receive trace informationjava.io.IOException
- if an error occurs opening the filepublic int getLevel()
public static void setLevel(int newLevel)
newLevel
- new trace levelpublic void trace(int level, java.lang.String message)
trace
in interface TraceInterface
level
- trace level for message.message
- String
to output.public void trace(int color, int level, java.lang.String message)
trace
in interface TraceInterface
color
- Ignored herelevel
- trace level for message.message
- String
to output.public void trace(int level, XmlDocument document)
trace
in interface TraceInterface
level
- trace level for document.document
- The XML document to outputprotected void traceAlways(java.lang.String message)
message
- String
to outputprotected void traceAlways(org.w3c.dom.Document document)
Document
regardless of leveldocument
- XML Document
protected static java.lang.String timeStampMessage(java.lang.String message)
message
- String to which to prepend timestamp.