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 2015/12/02 06:36:16 UTC

[2/2] logging-log4j2 git commit: Add back and deprecate method.

Add back and deprecate method.

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

Branch: refs/heads/master
Commit: 1c786f6afb1e488a0271206c85df9c151b61452d
Parents: c50af9c
Author: ggregory <gg...@apache.org>
Authored: Tue Dec 1 21:36:10 2015 -0800
Committer: ggregory <gg...@apache.org>
Committed: Tue Dec 1 21:36:10 2015 -0800

----------------------------------------------------------------------
 .../log4j/core/appender/SocketAppender.java     | 89 ++++++++++++++++----
 1 file changed, 73 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1c786f6a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
index 87ba697..9b2ec0d 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
@@ -77,34 +77,34 @@ public class SocketAppender extends AbstractOutputStreamAppender<AbstractSocketM
      * Creates a socket appender.
      * 
      * @param host
-     *        The name of the host to connect to.
+     *            The name of the host to connect to.
      * @param portNum
-     *        The port to connect to on the target host.
+     *            The port to connect to on the target host.
      * @param protocolIn
-     *        The Protocol to use.
+     *            The Protocol to use.
      * @param sslConfig
-     *        The SSL configuration file for TCP/SSL, ignored for UPD.
+     *            The SSL configuration file for TCP/SSL, ignored for UPD.
      * @param connectTimeoutMillis
-     *        the connect timeout in milliseconds.
+     *            the connect timeout in milliseconds.
      * @param delayMillis
-     *        The interval in which failed writes should be retried.
+     *            The interval in which failed writes should be retried.
      * @param immediateFail
-     *        True if the write should fail if no socket is immediately available.
+     *            True if the write should fail if no socket is immediately available.
      * @param name
-     *        The name of the Appender.
+     *            The name of the Appender.
      * @param immediateFlush
-     *        "true" if data should be flushed on each write.
+     *            "true" if data should be flushed on each write.
      * @param ignore
-     *        If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they are
-     *        propagated to the caller.
+     *            If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they
+     *            are propagated to the caller.
      * @param layout
-     *        The layout to use (defaults to SerializedLayout).
+     *            The layout to use (defaults to SerializedLayout).
      * @param filter
-     *        The Filter or null.
+     *            The Filter or null.
      * @param advertise
-     *        "true" if the appender configuration should be advertised, "false" otherwise.
+     *            "true" if the appender configuration should be advertised, "false" otherwise.
      * @param config
-     *        The Configuration
+     *            The Configuration
      * @return A SocketAppender.
      */
     @PluginFactory
@@ -153,10 +153,67 @@ public class SocketAppender extends AbstractOutputStreamAppender<AbstractSocketM
     }
 
     /**
+     * Creates a socket appender.
+     * 
+     * @param host
+     *            The name of the host to connect to.
+     * @param portNum
+     *            The port to connect to on the target host.
+     * @param protocolIn
+     *            The Protocol to use.
+     * @param sslConfig
+     *            The SSL configuration file for TCP/SSL, ignored for UPD.
+     * @param connectTimeoutMillis
+     *            the connect timeout in milliseconds.
+     * @param delayMillis
+     *            The interval in which failed writes should be retried.
+     * @param immediateFail
+     *            True if the write should fail if no socket is immediately available.
+     * @param name
+     *            The name of the Appender.
+     * @param immediateFlush
+     *            "true" if data should be flushed on each write.
+     * @param ignore
+     *            If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they
+     *            are propagated to the caller.
+     * @param layout
+     *            The layout to use (defaults to SerializedLayout).
+     * @param filter
+     *            The Filter or null.
+     * @param advertise
+     *            "true" if the appender configuration should be advertised, "false" otherwise.
+     * @param config
+     *            The Configuration
+     * @return A SocketAppender.
+     * @deprecated Use {@link #createAppender(String, String, Protocol, SslConfiguration, int, String, String, String, String, String, Layout, Filter, String, Configuration)}.
+     */
+    @Deprecated
+    public static SocketAppender createAppender(
+            // @formatter:off
+            @PluginAttribute("host") final String host,
+            @PluginAttribute("port") final String portNum,
+            @PluginAttribute("protocol") final String protocolIn,
+            @PluginElement("SSL") final SslConfiguration sslConfig,
+            @PluginAttribute(value = "connectTimeoutMillis", defaultInt = 0) final int connectTimeoutMillis,
+            @PluginAliases("reconnectionDelay") // deprecated
+            @PluginAttribute("reconnectionDelayMillis") final String delayMillis,
+            @PluginAttribute("immediateFail") final String immediateFail,
+            @PluginAttribute("name") final String name,
+            @PluginAttribute("immediateFlush") final String immediateFlush,
+            @PluginAttribute("ignoreExceptions") final String ignore,
+            @PluginElement("Layout") Layout<? extends Serializable> layout,
+            @PluginElement("Filter") final Filter filter,
+            @PluginAttribute("advertise") final String advertise, @PluginConfiguration final Configuration config) {
+            // @formatter:on
+        return createAppender(host, portNum, protocolIn, sslConfig, connectTimeoutMillis, delayMillis, immediateFail,
+                name, immediateFlush, ignore, layout, filter, advertise, config);
+    }
+
+    /**
      * Creates an AbstractSocketManager for TCP, UDP, and SSL.
      * 
      * @throws IllegalArgumentException
-     *         if the protocol cannot be handled.
+     *             if the protocol cannot be handled.
      */
     protected static AbstractSocketManager createSocketManager(final String name, Protocol protocol, final String host,
             final int port, final int connectTimeoutMillis, final SslConfiguration sslConfig, final int delayMillis,