////
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
////

[#managedcoloredconsoleappender]
= ManagedColoredConsoleAppender

The `ManagedColoredConsoleAppender` writes log messages to the console with colored output.
It provides more control over the colors used for different log levels.

The following example shows how to configure the `ManagedColoredConsoleAppender` to log messages to the console.
By default the messages are sent to the console standard output stream.

This example shows how to highlight error messages.

[source,xml]
----
<appender name="ManagedColoredConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
  <mapping>
    <level value="ERROR" />
    <foreColor value="White" />
    <backColor value="Red" />
  </mapping>
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
  </layout>
</appender>
----

This example shows how to colorize multiple levels.

[source,xml]
----
<appender name="ManagedColoredConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
  <mapping>
    <level value="ERROR" />
    <foreColor value="DarkRed" />
  </mapping>
  <mapping>
    <level value="WARN" />
    <foreColor value="Yellow" />
  </mapping>
  <mapping>
    <level value="INFO" />
    <foreColor value="White" />
  </mapping>
  <mapping>
    <level value="DEBUG" />
    <foreColor value="Blue" />
  </mapping>
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date %-5level %logger - %message%newline"/>
  </layout>
</appender>
----