NLOG4J 1.2.24

org.apache.log4j
Class ConsoleAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.apache.log4j.WriterAppender
          extended by 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ü

Field Summary
static String SYSTEM_ERR
           
static String SYSTEM_OUT
           
protected  String target
           
 
Fields inherited from class org.apache.log4j.WriterAppender
encoding, immediateFlush, qw
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
ConsoleAppender()
          The default constructor does nothing.
ConsoleAppender(Layout layout)
           
ConsoleAppender(Layout layout, String target)
           
 
Method Summary
 void activateOptions()
          Does nothing.
protected  void closeWriter()
          This method overrides the parent WriterAppender.closeWriter() implementation to do nothing because the console stream is not ours to close.
 String getTarget()
          Returns the current value of the Target property.
 void setTarget(String value)
          Sets the value of the Target option.
 
Methods inherited from class org.apache.log4j.WriterAppender
append, checkEntryConditions, close, createWriter, getEncoding, getImmediateFlush, requiresLayout, reset, setEncoding, 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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_OUT

public static final String SYSTEM_OUT
See Also:
Constant Field Values

SYSTEM_ERR

public static final String SYSTEM_ERR
See Also:
Constant Field Values

target

protected String target
Constructor Detail

ConsoleAppender

public ConsoleAppender()
The default constructor does nothing.


ConsoleAppender

public ConsoleAppender(Layout layout)

ConsoleAppender

public ConsoleAppender(Layout layout,
                       String target)
Method Detail

setTarget

public void setTarget(String value)
Sets the value of the Target option. Recognized values are "System.out" and "System.err". Any other value will be ignored.


getTarget

public String getTarget()
Returns the current value of the Target property. The default value of the option is "System.out". See also setTarget(java.lang.String).


activateOptions

public void activateOptions()
Description copied from class: WriterAppender
Does nothing.

Specified by:
activateOptions in interface OptionHandler
Overrides:
activateOptions in class WriterAppender

closeWriter

protected final void closeWriter()
This method overrides the parent WriterAppender.closeWriter() implementation to do nothing because the console stream is not ours to close.

Overrides:
closeWriter in class WriterAppender

NLOG4J 1.2.24

Copyright 2000-2005 Apache Software Foundation.