Repository: logging-log4j2 Updated Branches: refs/heads/master bba412896 -> 3cfabdeb9
[LOG4J2-1700] Update Jansi from 1.13 to 1.14. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3cfabdeb Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3cfabdeb Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3cfabdeb Branch: refs/heads/master Commit: 3cfabdeb9a8cefebd48da3409ab0d9a059a06de4 Parents: bba4128 Author: Gary Gregory <[email protected]> Authored: Fri Nov 11 21:58:02 2016 -0800 Committer: Gary Gregory <[email protected]> Committed: Fri Nov 11 21:58:02 2016 -0800 ---------------------------------------------------------------------- .../ConsoleAppenderAnsiMessagesMain.java | 108 +++++++------- .../ConsoleAppenderAnsiStyleJira180Main.java | 118 +++++++-------- .../ConsoleAppenderAnsiStyleJira272Main.java | 118 +++++++-------- .../ConsoleAppenderAnsiStyleJira319Main.java | 122 ++++++++-------- .../ConsoleAppenderAnsiStyleLayoutMain.java | 146 +++++++++---------- ...nsoleAppenderDefaultSuppressedThrowable.java | 128 ++++++++-------- .../ConsoleAppenderJAnsiMessageMain.java | 2 +- .../ConsoleAppenderJAnsiXExceptionMain.java | 2 +- .../ConsoleAppenderNoAnsiStyleLayoutMain.java | 142 +++++++++--------- .../log4j/core/appender/Jira739Test.java | 100 ++++++------- pom.xml | 2 +- src/changes/changes.xml | 3 + 12 files changed, 497 insertions(+), 494 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiMessagesMain.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiMessagesMain.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiMessagesMain.java index 2569ed3..f8ea731 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiMessagesMain.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiMessagesMain.java @@ -1,54 +1,54 @@ -/* - * 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.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiMessagesMain log4j-core/target/test-classes/log4j2-console.xml - * </pre> - */ -public class ConsoleAppenderAnsiMessagesMain { - - private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiMessagesMain.class); - - public static void main(final String[] args) { - try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), - "target/test-classes/log4j2-console.xml")) { - LOG.fatal("\u001b[1;35mFatal message.\u001b[0m"); - LOG.error("\u001b[1;31mError message.\u001b[0m"); - LOG.warn("\u001b[0;33mWarning message.\u001b[0m"); - LOG.info("\u001b[0;32mInformation message.\u001b[0m"); - LOG.debug("\u001b[0;36mDebug message.\u001b[0m"); - LOG.trace("\u001b[0;30mTrace message.\u001b[0m"); - LOG.error("\u001b[1;31mError message.\u001b[0m", new IOException("test")); - } - } - -} +/* + * 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.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiMessagesMain log4j-core/target/test-classes/log4j2-console.xml + * </pre> + */ +public class ConsoleAppenderAnsiMessagesMain { + + private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiMessagesMain.class); + + public static void main(final String[] args) { + try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), + "target/test-classes/log4j2-console.xml")) { + LOG.fatal("\u001b[1;35mFatal message.\u001b[0m"); + LOG.error("\u001b[1;31mError message.\u001b[0m"); + LOG.warn("\u001b[0;33mWarning message.\u001b[0m"); + LOG.info("\u001b[0;32mInformation message.\u001b[0m"); + LOG.debug("\u001b[0;36mDebug message.\u001b[0m"); + LOG.trace("\u001b[0;30mTrace message.\u001b[0m"); + LOG.error("\u001b[1;31mError message.\u001b[0m", new IOException("test")); + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java index cc01bd7..5a7fcee 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java @@ -1,59 +1,59 @@ -/* - * 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 org.apache.logging.log4j.Level; -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; - -/** - * Tests https://issues.apache.org/jira/browse/LOG4J2-180 - * <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.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main log4j-core/target/test-classes/log4j2-180.xml - * </pre> - */ -public class ConsoleAppenderAnsiStyleJira180Main { - - private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiStyleJira180Main.class); - - public static void main(final String[] args) { - // System.out.println(System.getProperty("java.class.path")); - final String config = args.length == 0 ? "target/test-classes/log4j2-180.xml" : args[0]; - try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), - config)) { - LOG.fatal("Fatal message."); - LOG.error("Error message."); - LOG.warn("Warning message."); - LOG.info("Information message."); - LOG.debug("Debug message."); - LOG.trace("Trace message."); - try { - throw new NullPointerException(); - } catch (final Exception e) { - LOG.error("Error message.", e); - LOG.catching(Level.ERROR, e); - } - } - } - -} +/* + * 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 org.apache.logging.log4j.Level; +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; + +/** + * Tests https://issues.apache.org/jira/browse/LOG4J2-180 + * <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.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main log4j-core/target/test-classes/log4j2-180.xml + * </pre> + */ +public class ConsoleAppenderAnsiStyleJira180Main { + + private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiStyleJira180Main.class); + + public static void main(final String[] args) { + // System.out.println(System.getProperty("java.class.path")); + final String config = args.length == 0 ? "target/test-classes/log4j2-180.xml" : args[0]; + try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), + config)) { + LOG.fatal("Fatal message."); + LOG.error("Error message."); + LOG.warn("Warning message."); + LOG.info("Information message."); + LOG.debug("Debug message."); + LOG.trace("Trace message."); + try { + throw new NullPointerException(); + } catch (final Exception e) { + LOG.error("Error message.", e); + LOG.catching(Level.ERROR, e); + } + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java index ac4bf1c..9889f46 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java @@ -1,59 +1,59 @@ -/* - * 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 org.apache.logging.log4j.Level; -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; - -/** - * Tests https://issues.apache.org/jira/browse/LOG4J2-272 - * <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.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira272Main log4j-core/target/test-classes/log4j2-272.xml - * </pre> - */ -public class ConsoleAppenderAnsiStyleJira272Main { - - private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiStyleJira272Main.class); - - public static void main(final String[] args) { - // System.out.println(System.getProperty("java.class.path")); - final String config = args.length == 0 ? "target/test-classes/log4j2-272.xml" : args[0]; - try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config)) { - LOG.fatal("Fatal message."); - LOG.error("Error message."); - LOG.warn("Warning message."); - LOG.info("Information message."); - LOG.debug("Debug message."); - LOG.trace("Trace message."); - try { - throw new NullPointerException(); - } catch (final Exception e) { - LOG.error("Error message.", e); - LOG.catching(Level.ERROR, e); - } - LOG.warn("this is ok \n And all \n this have only\t\tblack colour \n and here is colour again?"); - LOG.info("Information message."); - } - } - -} +/* + * 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 org.apache.logging.log4j.Level; +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; + +/** + * Tests https://issues.apache.org/jira/browse/LOG4J2-272 + * <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.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira272Main log4j-core/target/test-classes/log4j2-272.xml + * </pre> + */ +public class ConsoleAppenderAnsiStyleJira272Main { + + private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiStyleJira272Main.class); + + public static void main(final String[] args) { + // System.out.println(System.getProperty("java.class.path")); + final String config = args.length == 0 ? "target/test-classes/log4j2-272.xml" : args[0]; + try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config)) { + LOG.fatal("Fatal message."); + LOG.error("Error message."); + LOG.warn("Warning message."); + LOG.info("Information message."); + LOG.debug("Debug message."); + LOG.trace("Trace message."); + try { + throw new NullPointerException(); + } catch (final Exception e) { + LOG.error("Error message.", e); + LOG.catching(Level.ERROR, e); + } + LOG.warn("this is ok \n And all \n this have only\t\tblack colour \n and here is colour again?"); + LOG.info("Information message."); + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira319Main.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira319Main.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira319Main.java index edfbb2a..54ad06c 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira319Main.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira319Main.java @@ -1,61 +1,61 @@ -/* - * 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 org.apache.logging.log4j.Level; -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; - -/** - * Tests https://issues.apache.org/jira/browse/LOG4J2-319 - * <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.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira319Main log4j-core/target/test-classes/log4j2-319.xml - * </pre> - */ -public class ConsoleAppenderAnsiStyleJira319Main { - - private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiStyleJira319Main.class); - - public static void main(final String[] args) { - // System.out.println(System.getProperty("java.class.path")); - final String config = args.length == 0 ? "target/test-classes/log4j2-319.xml" : args[0]; - try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), - config)) { - LOG.fatal("Fatal message."); - LOG.error("Error message."); - LOG.warn("Warning message."); - LOG.info("Information message."); - LOG.debug("Debug message."); - LOG.trace("Trace message."); - try { - throw new NullPointerException(); - } catch (final Exception e) { - LOG.error("Error message.", e); - LOG.catching(Level.ERROR, e); - } - LOG.warn("this is ok \n And all \n this have only\t\tblack colour \n and here is colour again?"); - LOG.info("Information message."); - } - } - -} +/* + * 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 org.apache.logging.log4j.Level; +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; + +/** + * Tests https://issues.apache.org/jira/browse/LOG4J2-319 + * <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.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira319Main log4j-core/target/test-classes/log4j2-319.xml + * </pre> + */ +public class ConsoleAppenderAnsiStyleJira319Main { + + private static final Logger LOG = LogManager.getLogger(ConsoleAppenderAnsiStyleJira319Main.class); + + public static void main(final String[] args) { + // System.out.println(System.getProperty("java.class.path")); + final String config = args.length == 0 ? "target/test-classes/log4j2-319.xml" : args[0]; + try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), + config)) { + LOG.fatal("Fatal message."); + LOG.error("Error message."); + LOG.warn("Warning message."); + LOG.info("Information message."); + LOG.debug("Debug message."); + LOG.trace("Trace message."); + try { + throw new NullPointerException(); + } catch (final Exception e) { + LOG.error("Error message.", e); + LOG.catching(Level.ERROR, e); + } + LOG.warn("this is ok \n And all \n this have only\t\tblack colour \n and here is colour again?"); + LOG.info("Information message."); + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleLayoutMain.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleLayoutMain.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleLayoutMain.java index a91aa3b..5e3bb0f 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleLayoutMain.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleLayoutMain.java @@ -1,73 +1,73 @@ -/* - * 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; -import org.junit.Test; - -/** - * 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> - * mvn -Dtest=org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain test - * </pre> - * or: - * <pre> - * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%HOME%\.m2\repository\org\fusesource\jansi\jansi\1.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain log4j-core/target/test-classes/log4j2-console-style-ansi.xml - * </pre> - * - */ -public class ConsoleAppenderAnsiStyleLayoutMain { - - public static void main(final String[] args) { - new ConsoleAppenderAnsiStyleLayoutMain().test(args); - } - - /** - * This is a @Test method to make it easy to run from a command line with {@code mvn -Dtest=FQCN test} - */ - @Test - public void test() { - test(null); - } - - public void test(final String[] args) { - // System.out.println(System.getProperty("java.class.path")); - final String config = args == null || args.length == 0 ? "target/test-classes/log4j2-console-style-ansi.xml" - : args[0]; - try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config)) { - final Logger logger = LogManager.getLogger(ConsoleAppenderAnsiStyleLayoutMain.class); - logger.fatal("Fatal message."); - logger.error("Error message."); - logger.warn("Warning message."); - logger.info("Information message."); - logger.debug("Debug message."); - logger.trace("Trace message."); - logger.error("Error message.", new IOException("test")); - } - } - -} +/* + * 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; +import org.junit.Test; + +/** + * 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> + * mvn -Dtest=org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain test + * </pre> + * or: + * <pre> + * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%HOME%\.m2\repository\org\fusesource\jansi\jansi\1.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain log4j-core/target/test-classes/log4j2-console-style-ansi.xml + * </pre> + * + */ +public class ConsoleAppenderAnsiStyleLayoutMain { + + public static void main(final String[] args) { + new ConsoleAppenderAnsiStyleLayoutMain().test(args); + } + + /** + * This is a @Test method to make it easy to run from a command line with {@code mvn -Dtest=FQCN test} + */ + @Test + public void test() { + test(null); + } + + public void test(final String[] args) { + // System.out.println(System.getProperty("java.class.path")); + final String config = args == null || args.length == 0 ? "target/test-classes/log4j2-console-style-ansi.xml" + : args[0]; + try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), config)) { + final Logger logger = LogManager.getLogger(ConsoleAppenderAnsiStyleLayoutMain.class); + logger.fatal("Fatal message."); + logger.error("Error message."); + logger.warn("Warning message."); + logger.info("Information message."); + logger.debug("Debug message."); + logger.trace("Trace message."); + logger.error("Error message.", new IOException("test")); + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderDefaultSuppressedThrowable.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderDefaultSuppressedThrowable.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderDefaultSuppressedThrowable.java index 756c433..8437232 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderDefaultSuppressedThrowable.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderDefaultSuppressedThrowable.java @@ -1,64 +1,64 @@ -/* - * 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.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderNoAnsiStyleLayoutMain log4j-core/target/test-classes/log4j2-console-style-ansi.xml - * </pre> - */ -public class ConsoleAppenderDefaultSuppressedThrowable { - - private static final Logger LOG = LogManager.getLogger(ConsoleAppenderDefaultSuppressedThrowable.class); - - public static void main(final String[] args) { - final String config = args.length == 0 ? "target/test-classes/log4j2-console-default-suppressed-throwable.xml" - : args[0]; - test(args, config); - } - - static void test(final String[] args, final String config) { - // System.out.println(System.getProperty("java.class.path")); - try (final LoggerContext ctx = Configurator - .initialize(ConsoleAppenderDefaultSuppressedThrowable.class.getName(), config)) { - final IOException ioEx = new IOException("test suppressed"); - ioEx.addSuppressed(new IOException("test suppressed 1", new IOException("test 1"))); - final IOException ioEx2 = new IOException("test 2"); - ioEx2.addSuppressed(new IOException("test 3")); - ioEx.addSuppressed(new IOException("test suppressed 2", ioEx2)); - final IOException e = new IOException("test", ioEx); - LOG.error("Error message {}, suppressed?", "Hi", e); - System.out.println("printStackTrace"); - e.printStackTrace(); - } - } - -} +/* + * 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.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderNoAnsiStyleLayoutMain log4j-core/target/test-classes/log4j2-console-style-ansi.xml + * </pre> + */ +public class ConsoleAppenderDefaultSuppressedThrowable { + + private static final Logger LOG = LogManager.getLogger(ConsoleAppenderDefaultSuppressedThrowable.class); + + public static void main(final String[] args) { + final String config = args.length == 0 ? "target/test-classes/log4j2-console-default-suppressed-throwable.xml" + : args[0]; + test(args, config); + } + + static void test(final String[] args, final String config) { + // System.out.println(System.getProperty("java.class.path")); + try (final LoggerContext ctx = Configurator + .initialize(ConsoleAppenderDefaultSuppressedThrowable.class.getName(), config)) { + final IOException ioEx = new IOException("test suppressed"); + ioEx.addSuppressed(new IOException("test suppressed 1", new IOException("test 1"))); + final IOException ioEx2 = new IOException("test 2"); + ioEx2.addSuppressed(new IOException("test 3")); + ioEx.addSuppressed(new IOException("test suppressed 2", ioEx2)); + final IOException e = new IOException("test", ioEx); + LOG.error("Error message {}, suppressed?", "Hi", e); + System.out.println("printStackTrace"); + e.printStackTrace(); + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiMessageMain.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiMessageMain.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiMessageMain.java index 68857b5..5c0857f 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiMessageMain.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiMessageMain.java @@ -42,7 +42,7 @@ import org.junit.Test; * or, on Windows: * * <pre> - * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%USERPROFILE%\.m2\repository\org\fusesource\jansi\jansi\1.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderJAnsiMessageMain log4j-core/src/test/resources/log4j2-console-msg-ansi.xml + * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%USERPROFILE%\.m2\repository\org\fusesource\jansi\jansi\1.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderJAnsiMessageMain log4j-core/src/test/resources/log4j2-console-msg-ansi.xml * </pre> * */ http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiXExceptionMain.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiXExceptionMain.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiXExceptionMain.java index de0b827..bd62bd4 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiXExceptionMain.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderJAnsiXExceptionMain.java @@ -39,7 +39,7 @@ import org.junit.Test; * or, on Windows: * * <pre> - * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%USERPROFILE%\.m2\repository\org\fusesource\jansi\jansi\1.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderJAnsiXExceptionMain log4j-core/src/test/resources/log4j2-console-xex-ansi.xml + * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%USERPROFILE%\.m2\repository\org\fusesource\jansi\jansi\1.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderJAnsiXExceptionMain log4j-core/src/test/resources/log4j2-console-xex-ansi.xml * </pre> * */ http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderNoAnsiStyleLayoutMain.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderNoAnsiStyleLayoutMain.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderNoAnsiStyleLayoutMain.java index a7bca96..bb08de4 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderNoAnsiStyleLayoutMain.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderNoAnsiStyleLayoutMain.java @@ -1,71 +1,71 @@ -/* - * 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.13\jansi-1.13.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); - - private static void logThrowableFromMethod() { - LOG.error("Error message.", new IOException("test")); - } - - public static void main(final String[] args) { - final String config = args.length == 0 ? "target/test-classes/log4j2-console-style-no-ansi.xml" : args[0]; - test(args, config); - } - - static void test(final String[] args, final String config) { - // System.out.println(System.getProperty("java.class.path")); - try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderNoAnsiStyleLayoutMain.class.getName(), - config)) { - 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: - final IOException ioException = new IOException("test"); - LOG.error("Error message {}", "Hi", ioException); - final Throwable t = new IOException("test suppressed"); - t.addSuppressed(new IOException("test suppressed 2", ioException)); - LOG.error("Error message {}, suppressed?", "Hi", t); - LOG.error("Error message {}, suppressed?", "Hi", new IOException("test", t)); - } - } - -} +/* + * 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.14\jansi-1.14.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); + + private static void logThrowableFromMethod() { + LOG.error("Error message.", new IOException("test")); + } + + public static void main(final String[] args) { + final String config = args.length == 0 ? "target/test-classes/log4j2-console-style-no-ansi.xml" : args[0]; + test(args, config); + } + + static void test(final String[] args, final String config) { + // System.out.println(System.getProperty("java.class.path")); + try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderNoAnsiStyleLayoutMain.class.getName(), + config)) { + 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: + final IOException ioException = new IOException("test"); + LOG.error("Error message {}", "Hi", ioException); + final Throwable t = new IOException("test suppressed"); + t.addSuppressed(new IOException("test suppressed 2", ioException)); + LOG.error("Error message {}, suppressed?", "Hi", t); + LOG.error("Error message {}, suppressed?", "Hi", new IOException("test", t)); + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java index e18aaa6..f46af07 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java @@ -1,50 +1,50 @@ -/* - * 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 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.13\jansi-1.13.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiMessagesMain log4j-core/target/test-classes/log4j2-console.xml - * </pre> - */ -public class Jira739Test { - - private static final Logger LOG = LogManager.getLogger(Jira739Test.class); - - public static void main(final String[] args) { - try (final LoggerContext ctx = Configurator.initialize(Jira739Test.class.getName(), - "target/test-classes/LOG4J2-739.xml")) { - for (int i = 0; i < 10; i++) { - LOG.trace("Entering Log4j Example " + i + " times"); - LOG.error("Ohh!Failed!"); - LOG.trace("Exiting Log4j Example." + i + " times"); - } - } - } - -} +/* + * 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 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.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiMessagesMain log4j-core/target/test-classes/log4j2-console.xml + * </pre> + */ +public class Jira739Test { + + private static final Logger LOG = LogManager.getLogger(Jira739Test.class); + + public static void main(final String[] args) { + try (final LoggerContext ctx = Configurator.initialize(Jira739Test.class.getName(), + "target/test-classes/LOG4J2-739.xml")) { + for (int i = 0; i < 10; i++) { + LOG.trace("Entering Log4j Example " + i + " times"); + LOG.error("Ohh!Failed!"); + LOG.trace("Exiting Log4j Example." + i + " times"); + } + } + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 91ecca6..ed0b692 100644 --- a/pom.xml +++ b/pom.xml @@ -401,7 +401,7 @@ <dependency> <groupId>org.fusesource.jansi</groupId> <artifactId>jansi</artifactId> - <version>1.13</version> + <version>1.14</version> <optional>true</optional> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3cfabdeb/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b36f805..1bb9464 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -114,6 +114,9 @@ <action issue="LOG4J2-1698" dev="ggregory" type="update"> Update LMAX Disruptor from 3.3.5 to 3.3.6. </action> + <action issue="LOG4J2-1700" dev="ggregory" type="update"> + Update Jansi from 1.13 to 1.14. + </action> <action issue="LOG4J2-1681" dev="rpopma" type="add"> Changed visibility of indexed getter methods in SortedArrayStringMap from package-protected to public. </action>
