public class ConsoleAppender extends WriterAppender
System.out
or
System.err
using a layout specified by the user. The
default target is System.out
.Modifier and Type | Class and Description |
---|---|
private static class |
ConsoleAppender.SystemErrStream
An implementation of OutputStream that redirects to the
current System.err.
|
private static class |
ConsoleAppender.SystemOutStream
An implementation of OutputStream that redirects to the
current System.out.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
follow
Determines if the appender honors reassignments of System.out
or System.err made after configuration.
|
static String |
SYSTEM_ERR |
static String |
SYSTEM_OUT |
protected String |
target |
encoding, immediateFlush, qw
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
Constructor and Description |
---|
ConsoleAppender()
Constructs an unconfigured appender.
|
ConsoleAppender(Layout layout)
Creates a configured appender.
|
ConsoleAppender(Layout layout,
String target)
Creates a configured appender.
|
Modifier and Type | Method and Description |
---|---|
void |
activateOptions()
Prepares the appender for use.
|
protected void |
closeWriter()
Close the underlying
Writer . |
boolean |
getFollow()
Gets whether the appender honors reassignments of System.out
or System.err made after configuration.
|
String |
getTarget()
Returns the current value of the Target property.
|
void |
setFollow(boolean newValue)
Sets whether the appender honors reassignments of System.out
or System.err made after configuration.
|
void |
setTarget(String value)
Sets the value of the Target option.
|
(package private) void |
targetWarn(String val) |
append, checkEntryConditions, close, createWriter, getEncoding, getImmediateFlush, requiresLayout, reset, setEncoding, setErrorHandler, setImmediateFlush, setWriter, shouldFlush, subAppend, writeFooter, writeHeader
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold
public static final String SYSTEM_OUT
public static final String SYSTEM_ERR
private boolean follow
public ConsoleAppender()
public ConsoleAppender(Layout layout)
layout
- layout, may not be null.public ConsoleAppender(Layout layout, String target)
layout
- layout, may not be null.target
- target, either "System.err" or "System.out".public void setTarget(String value)
public String getTarget()
setTarget(java.lang.String)
.public final void setFollow(boolean newValue)
newValue
- if true, appender will use value of System.out or
System.err in force at the time when logging events are appended.public final boolean getFollow()
void targetWarn(String val)
public void activateOptions()
activateOptions
in interface OptionHandler
activateOptions
in class WriterAppender
protected final void closeWriter()
Writer
.closeWriter
in class WriterAppender
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses