You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2013/08/23 20:05:17 UTC
svn commit: r1516954 - in /logging/log4j/log4j2/trunk/core/src/test:
java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java
resources/log4j2-180.xml
Author: ggregory
Date: Fri Aug 23 18:05:17 2013
New Revision: 1516954
URL: http://svn.apache.org/r1516954
Log:
Test https://issues.apache.org/jira/browse/LOG4J2-180.
Added:
logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java (with props)
logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml (with props)
Added: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java?rev=1516954&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java (added)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java Fri Aug 23 18:05:17 2013
@@ -0,0 +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-180
+ * <p>
+ * Running from a Windows command line from the root of the project:
+ * </p>
+ *
+ * <pre>
+ * java -classpath core\target\test-classes;core\target\classes;api\target\classes;%HOME%\.m2\repository\org\fusesource\jansi\jansi\1.11\jansi-1.11.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleJira180Main 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"));
+ String config = args.length == 0 ? "target/test-classes/log4j2-180.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);
+ }
+ } finally {
+ Configurator.shutdown(ctx);
+ }
+ }
+
+}
Propchange: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderAnsiStyleJira180Main.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml?rev=1516954&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml (added)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml Fri Aug 23 18:05:17 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="%d{ABSOLUTE} %-5level # %class.%method %m %style{%ex{1}}{green}%n" />
+ </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/core/src/test/resources/log4j2-180.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: logging/log4j/log4j2/trunk/core/src/test/resources/log4j2-180.xml
------------------------------------------------------------------------------
svn:keywords = Id