org.apache.log4j
Class ConsoleAppender
java.lang.Object
|
+--org.apache.log4j.AppenderSkeleton
|
+--org.apache.log4j.WriterAppender
|
+--org.apache.log4j.ConsoleAppender
- All Implemented Interfaces:
- Appender, OptionHandler
- public class ConsoleAppender
- extends WriterAppender
ConsoleAppender appends log events to System.out
or
System.err
using a layout specified by the
user. The default target is System.out
.
- Since:
- 1.1
- Author:
- Ceki Gülcü
Method Summary |
void |
activateOptions()
Does nothing. |
protected void |
closeWriter()
Override the parent method to do nothing. |
String[] |
getOptionStrings()
Deprecated. We now use JavaBeans introspection to configure
components. Options strings are no longer needed. |
String |
getTarget()
Returns the current value of the Target option. |
void |
setOption(String key,
String value)
Deprecated. Use the setter method for the option directly instead
of the generic setOption method. |
void |
setTarget(String value)
Sets the value of the Target option. |
Methods inherited from class org.apache.log4j.WriterAppender |
append, checkEntryConditions, close, getImmediateFlush, requiresLayout, reset, setErrorHandler, setImmediateFlush, setWriter, subAppend, writeFooter, writeHeader |
Methods inherited from class org.apache.log4j.AppenderSkeleton |
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold |
SYSTEM_OUT
public static final String SYSTEM_OUT
SYSTEM_ERR
public static final String SYSTEM_ERR
TARGET_OPTION
public static final String TARGET_OPTION
- Deprecated. Options are now handled using the JavaBeans paradigm.
This constant is not longer needed and will be removed in the
near term.
target
protected String target
ConsoleAppender
public ConsoleAppender()
- The default constructor does nothing.
ConsoleAppender
public ConsoleAppender(Layout layout)
ConsoleAppender
public ConsoleAppender(Layout layout,
String target)
setTarget
public void setTarget(String value)
- Sets the value of the Target option.
- Parameters:
value
- String identifying a console; recognized values are
"System.out" (default) and "System.err"
getTarget
public String getTarget()
- Returns the current value of the Target option.
activateOptions
public void activateOptions()
- Description copied from class:
WriterAppender
- Does nothing.
- Overrides:
activateOptions
in class WriterAppender
closeWriter
protected final void closeWriter()
- Override the parent method to do nothing.
- Overrides:
closeWriter
in class WriterAppender
getOptionStrings
public String[] getOptionStrings()
- Deprecated. We now use JavaBeans introspection to configure
components. Options strings are no longer needed.
- Returns the option names for this component, namely the string
array {
TARGET_OPTION
and the options of its super class
WriterAppender
.
See Options of the super classes WriterAppender
and
AppenderSkeleton
. In particular the Threshold
option.
- Overrides:
getOptionStrings
in class WriterAppender
setOption
public void setOption(String key,
String value)
- Deprecated. Use the setter method for the option directly instead
of the generic
setOption
method.
- Set ConsoleAppender specific options.
The Target option is recognized on top of options
for the super class
WriterAppender
.
- Overrides:
setOption
in class WriterAppender
Please notify me about new log4j releases.