public class StandardLogger extends Logger
Constructor and Description |
---|
StandardLogger()
Create a Logger that wraps the System.err output stream
|
StandardLogger(java.io.File fileName)
Create a Logger that writes to a specified file
|
StandardLogger(java.io.PrintStream stream)
Create a Logger that wraps the specified stream.
|
Modifier and Type | Method and Description |
---|---|
javax.xml.transform.stream.StreamResult |
asStreamResult()
Get a JAXP Result object allowing serialized XML to be written to this Logger
|
void |
close()
Close the logger, indicating that no further messages will be written
|
java.io.PrintStream |
getPrintStream()
Get the output destination used for messages
|
int |
getThreshold()
Get the minimum threshold for the severity of messages to be output.
|
void |
println(java.lang.String message,
int severity)
Output a message with a specified severity.
|
void |
setPrintStream(java.io.PrintStream stream)
Set the output destination for messages
|
void |
setThreshold(int threshold)
Set the minimum threshold for the severity of messages to be output.
|
disaster, error, info, isUnicodeAware, setUnicodeAware, warning
public StandardLogger()
public StandardLogger(java.io.PrintStream stream)
stream
- the stream to which the Logger's output should be writtenpublic StandardLogger(java.io.File fileName) throws java.io.FileNotFoundException
fileName
- the file to which output should be written. When the logger is closed,
output will be flushed to the file.java.io.FileNotFoundException
- if the file is not accessiblepublic void setPrintStream(java.io.PrintStream stream)
stream
- the stream to which messages will be written. Defaults to System.err. The caller
is responsible for closing the stream after use (it will not be closed by the
close() method on the Logger)public java.io.PrintStream getPrintStream()
public void setThreshold(int threshold)
Logger.INFO
. Messages whose severity is below this threshold will be ignoredthreshold
- the minimum severity of messages to be output.public int getThreshold()
Logger.INFO
. Messages whose severity is below this threshold will be ignoredpublic javax.xml.transform.stream.StreamResult asStreamResult()
asStreamResult
in class Logger
public void println(java.lang.String message, int severity)
println
in class Logger
message
- The message to be outputseverity
- The severity: one of Logger.INFO
, Logger.WARNING
, Logger.ERROR
,
Logger.DISASTER
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.