/*
 * 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.
 */
package org.apache.logging.log4j.core.appender;

import java.io.IOException;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;

/**
 * Shows how to use ANSI escape codes to color messages. Each message is printed to the console in color, but the rest
 * of the log entry (time stamp for example) is in the default color for that console.
 * <p>
 * Running from a Windows command line from the root of the project:
 * </p>
 * 
 * <pre>
 * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%HOME%\.m2\repository\org\fusesource\jansi\jansi\1.11\jansi-1.11.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderNoAnsiStyleLayoutMain log4j-core/target/test-classes/log4j2-console-style-ansi.xml
 * </pre>
 */
public class ConsoleAppenderNoAnsiStyleLayoutMain {

    private static final Logger LOG = LogManager.getLogger(ConsoleAppenderNoAnsiStyleLayoutMain.class);

    public static void main(final String[] args) {
        test(args);
    }

    static void test(final String[] args) {
        // System.out.println(System.getProperty("java.class.path"));
        final String config = args.length == 0 ? "target/test-classes/log4j2-console-style-no-ansi.xml" : args[0];
        final LoggerContext ctx = Configurator.initialize(ConsoleAppenderNoAnsiStyleLayoutMain.class.getName(), config);
        try {
            LOG.fatal("Fatal message.");
            LOG.error("Error message.");
            LOG.warn("Warning message.");
            LOG.info("Information message.");
            LOG.debug("Debug message.");
            LOG.trace("Trace message.");
            logThrowableFromMethod();
            // This will log the stack trace as well:
            LOG.error("Error message {}", "Hi", new IOException("test"));
        } finally {
            Configurator.shutdown(ctx);
        }
    }

    private static void logThrowableFromMethod() {
        LOG.error("Error message.", new IOException("test"));
    }

}

@@ -1859,21 +1859,22 @@
 ;%0A%0A    p
-ublic
+rivate
  static 
@@ -1882,53 +1882,94 @@
 oid 
-main(final String%5B%5D args) %7B%0A        test(args
+logThrowableFromMethod() %7B%0A        LOG.error(%22Error message.%22, new IOException(%22test%22)
 );%0A 
@@ -1978,16 +1978,23 @@
  %7D%0A%0A    
+public 
 static v
@@ -1997,20 +1997,20 @@
 ic void 
-test
+main
 (final S
@@ -2029,78 +2029,8 @@
 ) %7B%0A
-        // System.out.println(System.getProperty(%22java.class.path%22));%0A
     
@@ -2140,16 +2140,180 @@
 rgs%5B0%5D;%0A
+        test(args, config);%0A    %7D%0A%0A    static void test(final String%5B%5D args, String config) %7B%0A        // System.out.println(System.getProperty(%22java.class.path%22));%0A
         
@@ -2938,126 +2938,6 @@
  %7D%0A%0A
-    private static void logThrowableFromMethod() %7B%0A        LOG.error(%22Error message.%22, new IOException(%22test%22));%0A    %7D%0A%0A
 %7D%0A

Fix previous partial commit.