public class ConsoleAppender
extends org.apache.log4j.WriterAppender
System.out
or
System.err
using a layout specified by the user. The
default target is System.out
.Modifier and Type | Field and Description |
---|---|
static String |
SYSTEM_ERR |
static String |
SYSTEM_OUT |
protected String |
target |
Constructor and Description |
---|
ConsoleAppender()
Constructs an unconfigured appender.
|
ConsoleAppender(org.apache.log4j.Layout layout)
Creates a configured appender.
|
ConsoleAppender(org.apache.log4j.Layout layout,
String target)
Creates a configured appender.
|
Modifier and Type | Method and Description |
---|---|
void |
activateOptions()
Prepares the appender for use.
|
protected void |
closeWriter() |
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.
|
append, checkEntryConditions, close, createWriter, getEncoding, getImmediateFlush, requiresLayout, reset, setEncoding, setErrorHandler, setImmediateFlush, setWriter, shouldFlush, subAppend, writeFooter, writeHeader
public static final String SYSTEM_OUT
public static final String SYSTEM_ERR
protected String target
public ConsoleAppender()
public ConsoleAppender(org.apache.log4j.Layout layout)
layout
- layout, may not be null.public ConsoleAppender(org.apache.log4j.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()
public void activateOptions()
activateOptions
in interface org.apache.log4j.spi.OptionHandler
activateOptions
in class org.apache.log4j.WriterAppender
protected final void closeWriter()
closeWriter
in class org.apache.log4j.WriterAppender
Copyright © 2006–2019 OPS4J - Open Participation Software for Java. All rights reserved.