logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1519793 - in /logging/log4j/log4j2/trunk/log4j-core/src/test: java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java resources/log4j2-272.xml
Date Tue, 03 Sep 2013 18:47:24 GMT
Author: ggregory
Date: Tue Sep  3 18:47:23 2013
New Revision: 1519793

URL: http://svn.apache.org/r1519793
Log:
[LOG4J2-272] Malfunction of coloring with escaped characters (newline, tab).

Added:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java
  (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j2-272.xml   (with props)

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java?rev=1519793&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java
(added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java
Tue Sep  3 18:47:23 2013
@@ -0,0 +1,62 @@
+/*
+ * 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.11\jansi-1.11.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"));
+        String config = args.length == 0 ? "target/test-classes/log4j2-272.xml" : args[0];
+        final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.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.");
+            try {
+                throw new NullPointerException();
+            } catch (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.");
+        } finally {
+            Configurator.shutdown(ctx);
+        }
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira272Main.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j2-272.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j2-272.xml?rev=1519793&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j2-272.xml (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j2-272.xml Tue Sep  3 18:47:23
2013
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<!-- https://issues.apache.org/jira/browse/LOG4J2-180 -->
+<Configuration status="INFO">
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} -
%msg%n}{FATAL=bright red, ERROR=red, WARN=yellow, INFO=blue, DEBUG=green, TRACE=bright blue}"
/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Logger name="org.foo" level="DEBUG" />
+    <Root level="TRACE">
+      <AppenderRef ref="Console" />
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j2-272.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/resources/log4j2-272.xml
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message