You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/08/14 09:20:33 UTC

[2/3] logging-log4j2 git commit: Do not try to use Log4j 2 XmlLayout in place of Log4j 1 XmlLayout

Do not try to use Log4j 2 XmlLayout in place of Log4j 1 XmlLayout


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2642fff4
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2642fff4
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2642fff4

Branch: refs/heads/master
Commit: 2642fff465ac5d0523d33a1af3c6b8a5a10a3ade
Parents: d219411
Author: Mikael St�ldal <mi...@staldal.nu>
Authored: Sun Aug 14 11:09:40 2016 +0200
Committer: Mikael St�ldal <mi...@staldal.nu>
Committed: Sun Aug 14 11:09:40 2016 +0200

----------------------------------------------------------------------
 .../org/apache/log4j/config/Log4j1ConfigurationFactory.java    | 6 +++---
 .../apache/log4j/config/Log4j1ConfigurationFactoryTest.java    | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2642fff4/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
index 020da5e..396d6b1 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
@@ -57,7 +57,6 @@ import org.apache.logging.log4j.status.StatusLogger;
  * <li>layout = org.apache.log4j.SimpleLayout (complete)</li>
  * <li>layout = org.apache.log4j.TTCCLayout (complete)</li>
  * <li>layout = org.apache.log4j.HTMLLayout (partial)</li>
- * <li>layout = org.apache.log4j.xml.XMLLayout (partial)</li>
  * <li>layout.ConversionPattern</li>
  * </ul>
  * </ul>
@@ -144,11 +143,12 @@ public class Log4j1ConfigurationFactory extends ConfigurationFactory {
                 break;
             }
             case "org.apache.log4j.xml.XMLLayout": {
-                appenderBuilder.add(builder.newLayout("XmlLayout")); // TODO check if compatible
+                // We cannot use the XmlLayout in Log4j 2 since it has a significantly different format
+                reportWarning("Log4j 1 XMLLayout is not supported");
                 break;
             }
             default:
-                reportWarning("Unsupported value for console appender layout: " + layoutValue);
+                reportWarning("Unsupported layout: " + layoutValue);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2642fff4/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
index e4330ca..48a154d 100644
--- a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
@@ -29,6 +29,7 @@ import org.apache.logging.log4j.core.layout.HtmlLayout;
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.layout.XmlLayout;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class Log4j1ConfigurationFactoryTest {
@@ -81,7 +82,7 @@ public class Log4j1ConfigurationFactoryTest {
         Assert.assertTrue(layout instanceof TTCCLayout);
     }
 
-    @Test
+    @Ignore("XmlLayout not supported")
     public void testConsoleXmlLayout() throws Exception {
         final Layout<?> layout = testConsole("config-1.2/log4j-console-XmlLayout.properties");
         Assert.assertTrue(layout instanceof XmlLayout);