public class StandardLogger extends Logger
Constructor and Description |
---|
StandardLogger()
Create a Logger that wraps the System.err output stream
|
StandardLogger(File fileName)
Create a Logger that writes to a specified file
|
StandardLogger(PrintStream stream)
Create a Logger that wraps the specified stream.
|
Modifier and Type | Method and Description |
---|---|
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
|
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(String message,
int severity)
Output a message with a specified severity.
|
void |
setPrintStream(PrintStream stream)
Set the output destination for messages
|
void |
setThreshold(int threshold)
Set the minimum threshold for the severity of messages to be output.
|
public StandardLogger()
public StandardLogger(PrintStream stream)
stream
- the stream to which the Logger's output should be writtenpublic StandardLogger(File fileName) throws FileNotFoundException
fileName
- the file to which output should be written. When the logger is closed,
output will be flushed to the file.FileNotFoundException
- if the file is not accessiblepublic void setPrintStream(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 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 StreamResult asStreamResult()
asStreamResult
in class Logger
public void println(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-2014 Saxonica Limited. All rights reserved.