logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1187937 - in /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers: log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/ log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/ log4j2-core/src/main/java/org/ap...
Date Sun, 23 Oct 2011 17:29:21 GMT
Author: rgoers
Date: Sun Oct 23 17:29:21 2011
New Revision: 1187937

URL: http://svn.apache.org/viewvc?rev=1187937&view=rev
Log:
Pass configuration to RFC5424Layout

Modified:
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
    logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-jcl/log4j2-jcl.iml

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java?rev=1187937&r1=1187936&r2=1187937&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
Sun Oct 23 17:29:21 2011
@@ -17,8 +17,10 @@
 package org.apache.logging.log4j.core.appender;
 
 import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
+import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.filter.Filters;
@@ -66,6 +68,7 @@ public class SyslogAppender extends Sock
                                                 @PluginAttr("mdcRequired") String required,
                                                 @PluginAttr("format") String format,
                                                 @PluginElement("filters") Filters filters,
+                                                @PluginConfiguration Configuration config,
                                                 @PluginAttr("charset") String charset) {
 
         boolean isFlush = immediateFlush == null ? true : Boolean.valueOf(immediateFlush);;
@@ -82,7 +85,7 @@ public class SyslogAppender extends Sock
         }
         Layout layout = (format.equalsIgnoreCase(RFC5424)) ?
             RFC5424Layout.createLayout(facility, id, ein, includeMDC, mdcId, includeNL, appName,
 msgId,
-                excludes, includes, required, charset) :
+                excludes, includes, required, charset, config) :
             SyslogLayout.createLayout(facility, includeNL, charset);
 
         if (name == null) {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java?rev=1187937&r1=1187936&r2=1187937&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/flume/FlumeAvroAppender.java
Sun Oct 23 17:29:21 2011
@@ -116,8 +116,8 @@ public class FlumeAvroAppender extends A
         int retries = agentRetries == null ? 0 : Integer.parseInt(agentRetries);
 
         if (layout == null) {
-            layout = RFC5424Layout.createLayout(null, null, null, "True", null, null, null,
null, excludes, includes,
-                required, null);
+            layout = RFC5424Layout.createLayout(null, null, null, null, "True", null, null,
null, null, excludes,
+                includes, required, null);
         }
 
         if (name == null) {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java?rev=1187937&r1=1187936&r2=1187937&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
Sun Oct 23 17:29:21 2011
@@ -20,8 +20,10 @@ import org.apache.logging.log4j.LogManag
 import org.apache.logging.log4j.LoggingException;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
+import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.net.Facility;
 import org.apache.logging.log4j.core.net.Priority;
@@ -76,9 +78,9 @@ public class RFC5424Layout extends Abstr
     public static final int DEFAULT_ENTERPRISE_NUMBER = 18060;
     public static final String DEFAULT_ID = "Audit";
 
-    public RFC5424Layout(Facility facility, String id, int ein, boolean includeMDC, boolean
includeNL, String mdcId,
-                         String appName, String messageId, String excludes, String includes,
String required,
-                         Charset charset) {
+    private RFC5424Layout(Configuration config, Facility facility, String id, int ein, boolean
includeMDC,
+                          boolean includeNL, String mdcId, String appName, String messageId,
String excludes,
+                          String includes, String required, Charset charset) {
         super(charset);
         this.facility = facility;
         this.defaultId = id == null ? DEFAULT_ID : id;
@@ -133,8 +135,7 @@ public class RFC5424Layout extends Abstr
             mdcRequired = null;
         }
         this.checker = c != null ? c : noopChecker;
-        LoggerContext ctx = (LoggerContext) LogManager.getContext();
-        String name = ctx.getConfiguration().getName();
+        String name = config == null ? null :config.getName();
         configName = (name != null && name.length() > 0) ? name : null;
     }
 
@@ -385,7 +386,8 @@ public class RFC5424Layout extends Abstr
                                              @PluginAttr("mdcExcludes") String excludes,
                                              @PluginAttr("mdcIncludes") String includes,
                                              @PluginAttr("mdcRequired") String required,
-                                             @PluginAttr("charset") String charset) {
+                                             @PluginAttr("charset") String charset,
+                                             @PluginConfiguration Configuration config) {
         Charset c = Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset();
         if (charset != null) {
             if (Charset.isSupported(charset)) {
@@ -406,7 +408,7 @@ public class RFC5424Layout extends Abstr
             mdcId = DEFAULT_MDCID;
         }
 
-        return new RFC5424Layout(f, id, enterpriseNumber, isMdc, includeNewLine, mdcId, appName,
msgId, excludes,
+        return new RFC5424Layout(config, f, id, enterpriseNumber, isMdc, includeNewLine,
mdcId, appName, msgId, excludes,
                                  includes, required, c);
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTest.java?rev=1187937&r1=1187936&r2=1187937&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTest.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTest.java
Sun Oct 23 17:29:21 2011
@@ -191,7 +191,8 @@ public class SyslogAppenderTest {
 
     private SyslogAppender createAppender(String protocol, String format) {
         return SyslogAppender.createAppender("localhost", PORT, protocol, "-1", "Test", "true",
"false", "LOCAL0", "Audit",
-            "18060", "true", "RequestContext", "true", "TestApp", "Test", null, "ipAddress,loginId",
null, format, null, null);
+            "18060", "true", "RequestContext", "true", "TestApp", "Test", null, "ipAddress,loginId",
null, format, null,
+                null, null);
     }
 
     public static class UDPSocketServer extends Thread {

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java?rev=1187937&r1=1187936&r2=1187937&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
Sun Oct 23 17:29:21 2011
@@ -75,8 +75,8 @@ public class RFC5424LayoutTest {
     public void testLayout() throws Exception {
 
         // set up appender
-        RFC5424Layout layout = RFC5424Layout.createLayout("Local0", "Event", "3692", "true",
"RequestContext", "true",
-            "ATM", null, "key1, key2, locale", null, "loginId", null);
+        RFC5424Layout layout = RFC5424Layout.createLayout("Local0", "Event", "3692", "true",
"RequestContext",
+            "true", "ATM", null, "key1, key2, locale", null, "loginId", null, null);
         ListAppender appender = new ListAppender("List", null, layout, true, false);
         appender.start();
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-jcl/log4j2-jcl.iml
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-jcl/log4j2-jcl.iml?rev=1187937&r1=1187936&r2=1187937&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-jcl/log4j2-jcl.iml (original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-jcl/log4j2-jcl.iml Sun Oct
23 17:29:21 2011
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE"
version="4">
+<module MavenProjectsManager.isMavenModule="true" org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true"
relativePaths="true" type="JAVA_MODULE" version="4">
   <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
     <output url="file://$MODULE_DIR$/target/classes" />
     <output-test url="file://$MODULE_DIR$/target/test-classes" />



Mime
View raw message