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.logging.log4j.core.appender
Class ConsoleAppender

    java.lang.Object
      org.apache.logging.log4j.core.AbstractLifeCycle
          org.apache.logging.log4j.core.filter.AbstractFilterable
              org.apache.logging.log4j.core.appender.AbstractAppender
                  org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<OutputStreamManager>
                      org.apache.logging.log4j.core.appender.ConsoleAppender

All Implemented Interfaces:
  Serializable, Appender, Filterable, LifeCycle

    @Plugin(name="Console",
            category="Core",
            elementType="appender",
            printObject=true)
    public final class ConsoleAppender

extends AbstractOutputStreamAppender<OutputStreamManager>

ConsoleAppender appends log events to `System.out` or `System.err` using a layout specified by the user. The default target is `System.out`. TODO accessing System.out or .err as a byte stream instead of a writer bypasses the JVM's knowledge of the proper encoding. (RG) Encoding is handled within the Layout. Typically, a Layout will generate a String and then call getBytes which may use a configured encoding or the system default. OTOH, a Writer cannot print byte streams.

See Also:
  Serialized Form

Nested Class Summary
`static class` | `ConsoleAppender.Builder`
`static class` | `ConsoleAppender.Target` Enumeration of console destinations.

Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
`LifeCycle.State`

Field Summary

Fields inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
`immediateFlush`

Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`LOGGER`

Method Summary
`static ConsoleAppender` | `createAppender(Layout<? extends Serializable> layout, Filter filter, String targetStr, String name, String follow, String ignore)` Create a Console Appender.
`static ConsoleAppender` | `createDefaultAppenderForLayout(Layout<? extends Serializable> layout)`
`static ConsoleAppender.Builder` | `newBuilder()`

Methods inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
`append, getManager, start, stop`

Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
`error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString`

Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
`addFilter, getFilter, hasFilter, isFiltered, removeFilter`

Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
`getState, isStarted, isStopped`

Method Detail

### createAppender

    @PluginFactory
    public static ConsoleAppender createAppender(@PluginElement(value="Layout")
                                                               Layout<? extends Serializable> layout,
                                                               @PluginElement(value="Filter")
                                                               Filter filter,
                                                               @PluginAttribute(value="target",defaultString="SYSTEM_OUT")
                                                               String targetStr,
                                                               @PluginAttribute(value="name")
                                                               String name,
                                                               @PluginAttribute(value="follow",defaultBoolean=false)
                                                               String follow,
                                                               @PluginAttribute(value="ignoreExceptions",defaultBoolean=true)
                                                               String ignore)

  Create a Console Appender.

  Parameters:
    `layout` - The layout to use (required).
    `filter` - The Filter or null.
    `targetStr` - The target ("SYSTEM_OUT" or "SYSTEM_ERR"). The default is "SYSTEM_OUT".
    `follow` - If true will follow changes to the underlying output stream.
    `name` - The name of the Appender (required).
    `ignore` - If `"true"` (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
  Returns:
    The ConsoleAppender.

### createDefaultAppenderForLayout

    public static ConsoleAppender createDefaultAppenderForLayout(Layout<? extends Serializable> layout)

### newBuilder

    @PluginBuilderFactory
    public static ConsoleAppender.Builder newBuilder()

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-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.