Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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ü, Curt Arnold

Field Summary
`static java.lang.String` | `SYSTEM_ERR`
`static java.lang.String` | `SYSTEM_OUT`
`protected java.lang.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()` Constructs an unconfigured appender.
`ConsoleAppender(Layout layout)` Creates a configured appender.
`ConsoleAppender(Layout layout, java.lang.String target)` Creates a configured appender.

Method Summary
`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.
`java.lang.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(java.lang.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 java.lang.String SYSTEM_OUT

See Also:
  Constant Field Values

### SYSTEM_ERR

    public static final java.lang.String SYSTEM_ERR

See Also:
  Constant Field Values

### target

    protected java.lang.String target

Constructor Detail

### ConsoleAppender

    public ConsoleAppender()

  Constructs an unconfigured appender.

### ConsoleAppender

    public ConsoleAppender(Layout layout)

  Creates a configured appender.

  Parameters:
    `layout` - layout, may not be null.

### ConsoleAppender

    public ConsoleAppender(Layout layout,
                           java.lang.String target)

  Creates a configured appender.

  Parameters:
    `layout` - layout, may not be null.
    `target` - target, either "System.err" or "System.out".

Method Detail

### setTarget

    public void setTarget(java.lang.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 java.lang.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)`.

### setFollow

    public final void setFollow(boolean newValue)

  Sets whether the appender honors reassignments of System.out or System.err made after configuration.

  Parameters:
    `newValue` - if true, appender will use value of System.out or System.err in force at the time when logging events are appended.
  Since:
    1.2.13

### getFollow

    public final boolean getFollow()

  Gets whether the appender honors reassignments of System.out or System.err made after configuration.

  Returns:
    true if appender will use value of System.out or System.err in force at the time when logging events are appended.
  Since:
    1.2.13

### activateOptions

    public void activateOptions()

  Prepares the appender for use.

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

### closeWriter

    protected final void closeWriter()

  Close the underlying `Writer`.

  Overrides:
    `closeWriter` in class `WriterAppender`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.