You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sd...@apache.org on 2013/02/28 08:57:51 UTC

svn commit: r1451133 [2/2] - in /logging/log4j/log4j2/trunk: ./ core/ core/src/main/java/org/apache/logging/log4j/core/ core/src/main/java/org/apache/logging/log4j/core/appender/ core/src/main/java/org/apache/logging/log4j/core/appender/rolling/ core/s...

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java?rev=1451133&r1=1451132&r2=1451133&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/PatternLayoutTest.java Thu Feb 28 07:57:49 2013
@@ -77,7 +77,7 @@ public class PatternLayoutTest {
         final PatternLayout layout = PatternLayout.createLayout(msgPattern, ctx.getConfiguration(), null, null);
         //FileOutputStream fos = new FileOutputStream(OUTPUT_FILE + "_mdc");
         final FileAppender appender = FileAppender.createAppender(OUTPUT_FILE + "_mdc", "false", "false", "File", "false",
-            "true", "false", layout, null);
+            "true", "false", layout, null, "false", null, null);
         appender.start();
 
         // set appender on root and set level to debug

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java?rev=1451133&r1=1451132&r2=1451133&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java Thu Feb 28 07:57:49 2013
@@ -92,7 +92,7 @@ public class SocketServerTest {
         final Filter socketFilter = new ThreadFilter(Filter.Result.NEUTRAL, Filter.Result.DENY);
         final Filter serverFilter = new ThreadFilter(Filter.Result.DENY, Filter.Result.NEUTRAL);
         final SocketAppender appender = SocketAppender.createAppender("localhost", PORT, "tcp", "-1",
-            "Test", null, null, null, socketFilter);
+            "Test", null, null, null, socketFilter, null, null);
         appender.start();
         final ListAppender listApp = new ListAppender("Events", serverFilter, null, false, false);
         listApp.start();

Added: logging/log4j/log4j2/trunk/core/src/test/resources/log4j-advertiser.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/log4j-advertiser.xml?rev=1451133&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/log4j-advertiser.xml (added)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/log4j-advertiser.xml Thu Feb 28 07:57:49 2013
@@ -0,0 +1,54 @@
+<?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.
+
+-->
+<configuration status="debug" dest="target/status.log" name="XMLConfigTest" packages="org.apache.logging.log4j.test" 
+               advertiser="org.apache.logging.log4j.core.config.InMemoryAdvertiser">
+  <ThresholdFilter level="debug"/>
+
+  <appenders>
+    <File name="File1" fileName="target/test.log" bufferedIO="false" advertiseURI="file:/some/path/to/target/test.log" advertise="true">
+      <PatternLayout>
+        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
+      </PatternLayout>
+    </File>
+    <File name="File2" fileName="target/test2.log" bufferedIO="false">
+      <PatternLayout>
+        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
+      </PatternLayout>
+    </File>
+    <Socket name="Socket1" host="localhost" port="5560" protocol="TCP" suppressExceptions="false"
+              reconnectionDelay="250" advertise="true">
+      <PatternLayout pattern="%msg%n"/>
+    </Socket>
+    <Socket name="Socket2" host="localhost" port="5565" protocol="UDP" suppressExceptions="false"
+          reconnectionDelay="250">
+      <PatternLayout pattern="%msg%n"/>
+    </Socket>
+  </appenders>
+
+  <loggers>
+    <logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
+      <appender-ref ref="File2"/>
+    </logger>>
+
+    <root level="error">
+      <appender-ref ref="File1"/>
+    </root>
+  </loggers>
+
+</configuration>

Modified: logging/log4j/log4j2/trunk/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/pom.xml?rev=1451133&r1=1451132&r2=1451133&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/pom.xml (original)
+++ logging/log4j/log4j2/trunk/pom.xml Thu Feb 28 07:57:49 2013
@@ -51,6 +51,11 @@
       <email>ggregory@apache.org</email>
       <organization>Rocket Software</organization>
     </developer>
+    <developer>
+      <id>sdeboy</id>
+      <name>Scott Deboy</name>
+      <email>sdeboy@apache.org</email>
+    </developer>
   </developers>
   <mailingLists>
     <mailingList>

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/index.xml?rev=1451133&r1=1451132&r2=1451133&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/index.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/index.xml Thu Feb 28 07:57:49 2013
@@ -21,6 +21,7 @@
         <title>Log4J2 Guide</title>
         <author email="rgoers@apache.org">Ralph Goers</author>
         <author email="ggregory@apache.org">Gary Gregory</author>
+        <author email="sdeboy@apache.org">Scott Deboy</author>
     </properties>
 
     <body>

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/configuration.xml.vm
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/configuration.xml.vm?rev=1451133&r1=1451132&r2=1451133&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/configuration.xml.vm (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/configuration.xml.vm Thu Feb 28 07:57:49 2013
@@ -268,6 +268,43 @@ public class Bar {
 ...
 </configuration>]]></pre>
         </subsection>
+        <a name="AdvertisingAppenderConfigurations"/>
+        <subsection name="Advertising Appender Configurations">
+          <p>
+            Log4j provides the ability to expose appender configurations to external systems.
+            If the advertiser attribute of the configuration element is set to the fully qualified 
+            class name of an Advertiser implementation, the Advertiser will be provided the appender configuration details which the Advertiser can
+            publish.  Other external systems can discover that published information, in order to automatically
+            process data generated by the appender.  Advertisement is then enabled in the specific appender configuration.
+          </p>
+          <p>
+            Log4j currently provides one Advertiser implementation: a Multicast DNS advertiser, which can be used to automatically
+            process a log file or begin receiving events from a socket-based appender, without the receiving end having to manually 
+            configure processing of the appender data.  Other possible Advertiser implementations may use JMX or write appender configuration details
+            to a custom database.
+          </p>
+          <p>
+            Chainsaw supports discovery of published Multicast DNS entries for file appender and socket-based appenders.  By specifying the 
+            Multicast DNS advertiser on the configuration and enabling advertisement on the specific appender, a Chainsaw user could 'double click'
+            on a discovered appender entry in the Chainsaw UI in order to begin receiving events generated by that appender, with no further
+            user configuration required.
+          </p>
+          <p>
+            Note that individual appenders may require additional information in order to publish the appender configuration.  For example,
+            a FileAppender must specify an advertiseURI which can be used to retrieve the file contents. 
+            file://, http:// and Apache Commons VFS-supported URIs are all supported by Chainsaw.
+          </p>
+          <pre class="prettyprint linenums"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration advertiser="org.apache.logging.log4j.core.net.MulticastDNSAdvertiser">
+...
+</configuration>
+<appenders>
+  <File name="File1" fileName="target/test.log" bufferedIO="false" advertiseURI="http://path/to/output.log" advertise="true">
+  ...
+  </File>
+</appenders>]]></pre>
+</subsection>
         <a name="ConfigurationSyntax"/>
         <subsection name="Configuration Syntax">
           <p>
@@ -279,7 +316,7 @@ public class Bar {
           </p>
           <h4>Configuration with XML</h4>
           <p>
-            The configuration element in the XML file accetps several attributes:
+            The configuration element in the XML file accepts several attributes:
             <table>
               <tr>
                 <th>Attribute Name</th>
@@ -577,7 +614,7 @@ public class Bar {
             required. Trying to configure Log4j without understanding those concepts will lead to frustration.
           </p>
           <p>
-            A LoggerConfig is configured using the <code>logger</code> element. The <code>logger</code> eleemnt
+            A LoggerConfig is configured using the <code>logger</code> element. The <code>logger</code> element
             must have a name attribute specified, will usually have a level attribute specified and may
             also have an additivity attribute specified.  The level may be configured with one of TRACE,
             DEBUG, INFO, WARN, ERROR, ALL or OFF. If no level is specified it will default to ERROR. The
@@ -615,7 +652,7 @@ public class Bar {
           </p>
           <p>
             Most appenders also support a layout to be configured (which again may be specified either
-            using the specific Layout plugin's name as the eleemnt or with "layout" as the element name
+            using the specific Layout plugin's name as the element or with "layout" as the element name
             along with a type attribute that contains the layout plugin's name. The various appenders
             will contain other attributes or elements that are required for them to function properly.
           </p>