logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1582188 - in /logging/log4j/log4j2/trunk/log4j-core/src: main/java/org/apache/logging/log4j/core/ main/java/org/apache/logging/log4j/core/net/ test/java/org/apache/logging/log4j/core/net/
Date Thu, 27 Mar 2014 05:16:32 GMT
Author: ggregory
Date: Thu Mar 27 05:16:31 2014
New Revision: 1582188

URL: http://svn.apache.org/r1582188
Log:
[LOG4J2-583] TCP and UDP socket servers should be able to handle XML log events. Refactor current code for XML and JSON. Create stubs for XML and JSON implementations.

Added:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/LogEventInput.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpJsonSocketServerTest.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpSerializedSocketServerTest.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpXmlSocketServerTest.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpJsonSocketServerTest.java   (with props)
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpSerializedSocketServerTest.java
      - copied, changed from r1582141, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UDPSocketServerTest.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpXmlSocketServerTest.java   (with props)
Removed:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TCPSocketServerTest.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UDPSocketServerTest.java
Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEventListener.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEventListener.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEventListener.java?rev=1582188&r1=1582187&r2=1582188&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEventListener.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEventListener.java Thu Mar 27 05:16:31 2014
@@ -30,6 +30,9 @@ public class LogEventListener {
     }
 
     protected void log(final LogEvent event) {
+        if (event == null) {
+            return;
+        }
         final Logger logger = context.getLogger(event.getLoggerName());
         if (logger.config.filter(event.getLevel(), event.getMarker(), event.getMessage(), event.getThrown())) {
             logger.config.logEvent(event);

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java?rev=1582188&r1=1582187&r2=1582188&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java Thu Mar 27 05:16:31 2014
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.core.Log
 import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.xml.XMLConfiguration;
 import org.apache.logging.log4j.core.config.xml.XMLConfigurationFactory;
+import org.apache.logging.log4j.core.helpers.Assert;
 
 /**
  * Abstract socket server for TCP and UDP implementations.
@@ -82,15 +83,18 @@ public abstract class AbstractSocketServ
             return super.getConfiguration(name, configLocation);
         }
     }
-    
+
     protected final Logger logger;
 
     protected static final int MAX_PORT = 65534;
 
     private volatile boolean active = true;
 
-    public AbstractSocketServer(int port) {
+    protected LogEventInput logEventInput;
+
+    public AbstractSocketServer(int port, LogEventInput logEventInput) {
         this.logger = LogManager.getLogger(this.getClass().getName() + '.' + port);
+        this.logEventInput = Assert.isNotNull(logEventInput, "LogEventInput");
     }
 
     protected boolean isActive() {

Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java Thu Mar 27 05:16:31 2014
@@ -0,0 +1,34 @@
+/*
+ * 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.net;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.logging.log4j.core.LogEvent;
+
+/**
+ * Reads JSON {@link LogEvent}s.
+ */
+public class JSONLogEventInput implements LogEventInput {
+
+    @Override
+    public LogEvent readLogEvent(InputStream inputStream) throws IOException {
+        throw new UnsupportedOperationException("Not  implemented yet");
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/LogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/LogEventInput.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/LogEventInput.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/LogEventInput.java Thu Mar 27 05:16:31 2014
@@ -0,0 +1,37 @@
+/*
+ * 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.net;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.logging.log4j.core.LogEvent;
+
+/**
+ * Reads {@link LogEvent}s from an input stream.
+ */
+public interface LogEventInput {
+
+    /**
+     * Reads a {@link LogEvent} from the given input stream.
+     * 
+     * @param inputStream the input stream to read
+     * @return a LogEvent
+     * @throws IOException 
+     */
+    LogEvent readLogEvent(InputStream inputStream) throws IOException;
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/LogEventInput.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/LogEventInput.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java Thu Mar 27 05:16:31 2014
@@ -0,0 +1,41 @@
+/*
+ * 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.net;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+
+import org.apache.logging.log4j.core.LogEvent;
+
+/**
+ * Reads serialized {@link LogEvent}s.
+ */
+public class SerializedLogEventInput implements LogEventInput {
+
+    @Override
+    public LogEvent readLogEvent(InputStream inputStream) throws IOException {
+        final ObjectInputStream ois = inputStream instanceof ObjectInputStream ? (ObjectInputStream) inputStream : new ObjectInputStream(
+                inputStream);
+        try {
+            return (LogEvent) ois.readObject();
+        } catch (ClassNotFoundException e) {
+            throw new IOException(e);
+        }
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java?rev=1582188&r1=1582187&r2=1582188&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java Thu Mar 27 05:16:31 2014
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.ne
 import java.io.BufferedReader;
 import java.io.EOFException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.ObjectInputStream;
 import java.io.OptionalDataException;
@@ -29,7 +30,6 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 
 /**
@@ -37,21 +37,90 @@ import org.apache.logging.log4j.core.con
  */
 public class TCPSocketServer extends AbstractSocketServer implements Runnable {
 
-    private final ServerSocket server;
+    /**
+     * Thread that processes the events.
+     */
+    private class SocketHandler extends Thread {
+        private final LogEventInput logEventInput;
 
-    private final ConcurrentMap<Long, SocketHandler> handlers = new ConcurrentHashMap<Long, SocketHandler>();
+        private final InputStream inputStream;
+
+        private boolean shutdown = false;
+
+        public SocketHandler(final Socket socket, LogEventInput logEventInput) throws IOException {
+            this.inputStream = new ObjectInputStream(socket.getInputStream());
+            this.logEventInput = logEventInput;
+        }
+
+        @Override
+        public void run() {
+            boolean closed = false;
+            try {
+                try {
+                    while (!shutdown) {
+                        log(logEventInput.readLogEvent(inputStream));
+                    }
+                } catch (final EOFException e) {
+                    closed = true;
+                } catch (final OptionalDataException e) {
+                    logger.error("OptionalDataException eof=" + e.eof + " length=" + e.length, e);
+                } catch (final IOException e) {
+                    logger.error("IOException encountered while reading from socket", e);
+                }
+                if (!closed) {
+                    try {
+                        inputStream.close();
+                    } catch (final Exception ex) {
+                        // Ignore the exception;
+                    }
+                }
+            } finally {
+                handlers.remove(Long.valueOf(getId()));
+            }
+        }
+
+        public void shutdown() {
+            this.shutdown = true;
+            interrupt();
+        }
+    }
 
     /**
-     * Constructor.
-     * @param port to listen on.
-     * @throws IOException If an error occurs.
+     * Creates a socket server that reads JSON log events.
+     * 
+     * @param port the port to listen
+     * @return a new a socket server
+     * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public TCPSocketServer(final int port) throws IOException {
-        super(port);
-        this.server = new ServerSocket(port);
+    public static TCPSocketServer createJsonSocketServer(int port) throws IOException {
+        return new TCPSocketServer(port, new JSONLogEventInput());
+    }
+
+    /**
+     * Creates a socket server that reads serialized log events.
+     * 
+     * @param port the port to listen
+     * @return a new a socket server
+     * @throws IOException if an I/O error occurs when opening the socket.
+     */
+    public static TCPSocketServer createSerializedSocketServer(int port) throws IOException {
+        return new TCPSocketServer(port, new SerializedLogEventInput());
     }
-     /**
+
+    /**
+     * Creates a socket server that reads XML log events.
+     * 
+     * @param port the port to listen
+     * @return a new a socket server
+     * @throws IOException if an I/O error occurs when opening the socket.
+     */
+    public static TCPSocketServer createXmlSocketServer(int port) throws IOException {
+        return new TCPSocketServer(port, new XMLLogEventInput());
+    }
+
+    /**
      * Main startup for the server.
+     * 
      * @param args The command line arguments.
      * @throws Exception if an error occurs.
      */
@@ -70,7 +139,8 @@ public class TCPSocketServer extends Abs
         if (args.length == 2 && args[1].length() > 0) {
             ConfigurationFactory.setConfigurationFactory(new ServerConfigurationFactory(args[1]));
         }
-        final TCPSocketServer socketServer = new TCPSocketServer(port);
+        final TCPSocketServer socketServer = TCPSocketServer.createSerializedSocketServer(port);
+        ;
         final Thread serverThread = new Thread(socketServer);
         serverThread.start();
         final Charset enc = Charset.defaultCharset();
@@ -89,12 +159,20 @@ public class TCPSocketServer extends Abs
         System.out.println("Usage: ServerSocket port configFilePath");
     }
 
+    private final ConcurrentMap<Long, SocketHandler> handlers = new ConcurrentHashMap<Long, SocketHandler>();
+
+    private final ServerSocket server;
+
     /**
-     * Shutdown the server.
+     * Constructor.
+     * 
+     * @param port to listen.
+     * @param logEventInput the log even input
+     * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public void shutdown() {
-        setActive(false);
-        Thread.currentThread().interrupt();
+    public TCPSocketServer(final int port, LogEventInput logEventInput) throws IOException {
+        super(port, logEventInput);
+        this.server = new ServerSocket(port);
     }
 
     /**
@@ -112,7 +190,7 @@ public class TCPSocketServer extends Abs
                 // If execution reaches this point, then it means that a client
                 // socket has been accepted.
 
-                final SocketHandler handler = new SocketHandler(clientSocket);
+                final SocketHandler handler = new SocketHandler(clientSocket, this.logEventInput);
                 handlers.put(Long.valueOf(handler.getId()), handler);
                 handler.start();
             } catch (final IOException ioe) {
@@ -132,53 +210,10 @@ public class TCPSocketServer extends Abs
     }
 
     /**
-     * Thread that processes the events.
+     * Shutdown the server.
      */
-    private class SocketHandler extends Thread {
-        private final ObjectInputStream ois;
-
-        private boolean shutdown = false;
-
-        public SocketHandler(final Socket socket) throws IOException {
-
-            ois = new ObjectInputStream(socket.getInputStream());
-        }
-
-        public void shutdown() {
-            this.shutdown = true;
-            interrupt();
-        }
-
-        @Override
-        public void run() {
-            boolean closed = false;
-            try {
-                try {
-                    while (!shutdown) {
-                        final LogEvent event = (LogEvent) ois.readObject();
-                        if (event != null) {
-                            log(event);
-                        }
-                    }
-                } catch (final EOFException eof) {
-                    closed = true;
-                } catch (final OptionalDataException opt) {
-                    logger.error("OptionalDataException eof=" + opt.eof + " length=" + opt.length, opt);
-                } catch (final ClassNotFoundException cnfe) {
-                    logger.error("Unable to locate LogEvent class", cnfe);
-                } catch (final IOException ioe) {
-                    logger.error("IOException encountered while reading from socket", ioe);
-                }
-                if (!closed) {
-                    try {
-                        ois.close();
-                    } catch (final Exception ex) {
-                        // Ignore the exception;
-                    }
-                }
-            } finally {
-                handlers.remove(Long.valueOf(getId()));
-            }
-        }
+    public void shutdown() {
+        setActive(false);
+        Thread.currentThread().interrupt();
     }
 }

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java?rev=1582188&r1=1582187&r2=1582188&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java Thu Mar 27 05:16:31 2014
@@ -21,12 +21,10 @@ import java.io.ByteArrayInputStream;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.io.ObjectInputStream;
 import java.io.OptionalDataException;
 import java.net.DatagramPacket;
 import java.net.DatagramSocket;
 
-import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 
 /**
@@ -34,31 +32,61 @@ import org.apache.logging.log4j.core.con
  */
 public class UDPSocketServer extends AbstractSocketServer implements Runnable {
 
-    private final DatagramSocket server;
+    /**
+     * Creates a socket server that reads JSON log events.
+     * 
+     * @param port the port to listen
+     * @return a new a socket server
+     * @throws IOException if an I/O error occurs when opening the socket.
+     */
+    public static UDPSocketServer createJsonSocketServer(int port) throws IOException {
+        return new UDPSocketServer(port, new JSONLogEventInput());
+    }
+
+    /**
+     * Creates a socket server that reads serialized log events.
+     * 
+     * @param port the port to listen
+     * @return a new a socket server
+     * @throws IOException if an I/O error occurs when opening the socket.
+     */
+    public static UDPSocketServer createSerializedSocketServer(int port) throws IOException {
+        return new UDPSocketServer(port, new SerializedLogEventInput());
+    }
+
+    /**
+     * Creates a socket server that reads XML log events.
+     * 
+     * @param port the port to listen
+     * @return a new a socket server
+     * @throws IOException if an I/O error occurs when opening the socket.
+     */
+    public static UDPSocketServer createXmlSocketServer(int port) throws IOException {
+        return new UDPSocketServer(port, new XMLLogEventInput());
+    }
+
+    private final DatagramSocket datagramSocket;
 
     // max size so we only have to deal with one packet
     private final int maxBufferSize = 1024 * 65 + 1024;
 
     /**
      * Constructor.
-     *
-     * @param port
-     *            to listen on.
-     * @throws IOException
-     *             If an error occurs.
-     */
-    public UDPSocketServer(final int port) throws IOException {
-        super(port);
-        this.server = new DatagramSocket(port);
+     * 
+     * @param port to listen on.
+     * @param logEventInput
+     * @throws IOException If an error occurs.
+     */
+    public UDPSocketServer(final int port, LogEventInput logEventInput) throws IOException {
+        super(port, logEventInput);
+        this.datagramSocket = new DatagramSocket(port);
     }
 
     /**
      * Main startup for the server.
-     *
-     * @param args
-     *            The command line arguments.
-     * @throws Exception
-     *             if an error occurs.
+     * 
+     * @param args The command line arguments.
+     * @throws Exception if an error occurs.
      */
     public static void main(final String[] args) throws Exception {
         if (args.length < 1 || args.length > 2) {
@@ -75,14 +103,14 @@ public class UDPSocketServer extends Abs
         if (args.length == 2 && args[1].length() > 0) {
             ConfigurationFactory.setConfigurationFactory(new ServerConfigurationFactory(args[1]));
         }
-        final UDPSocketServer sserver = new UDPSocketServer(port);
-        final Thread server = new Thread(sserver);
+        final UDPSocketServer socketServer = UDPSocketServer.createSerializedSocketServer(port);
+        final Thread server = new Thread(socketServer);
         server.start();
         final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         while (true) {
             final String line = reader.readLine();
             if (line == null || line.equalsIgnoreCase("Quit") || line.equalsIgnoreCase("Stop") || line.equalsIgnoreCase("Exit")) {
-                sserver.shutdown();
+                socketServer.shutdown();
                 server.join();
                 break;
             }
@@ -110,20 +138,15 @@ public class UDPSocketServer extends Abs
             try {
                 final byte[] buf = new byte[maxBufferSize];
                 final DatagramPacket packet = new DatagramPacket(buf, buf.length);
-                server.receive(packet);
-                final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(packet.getData(), packet.getOffset(), packet.getLength()));
-                final LogEvent event = (LogEvent) ois.readObject();
-                if (event != null) {
-                    log(event);
-                }
-            } catch (final OptionalDataException opt) {
-                logger.error("OptionalDataException eof=" + opt.eof + " length=" + opt.length, opt);
-            } catch (final ClassNotFoundException cnfe) {
-                logger.error("Unable to locate LogEvent class", cnfe);
-            } catch (final EOFException eofe) {
+                datagramSocket.receive(packet);
+                final ByteArrayInputStream bais = new ByteArrayInputStream(packet.getData(), packet.getOffset(), packet.getLength());
+                log(logEventInput.readLogEvent(bais));
+            } catch (final OptionalDataException e) {
+                logger.error("OptionalDataException eof=" + e.eof + " length=" + e.length, e);
+            } catch (final EOFException e) {
                 logger.info("EOF encountered");
-            } catch (final IOException ioe) {
-                logger.error("Exception encountered on accept. Ignoring. Stack Trace :", ioe);
+            } catch (final IOException e) {
+                logger.error("Exception encountered on accept. Ignoring. Stack Trace :", e);
             }
         }
     }

Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java Thu Mar 27 05:16:31 2014
@@ -0,0 +1,34 @@
+/*
+ * 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.net;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.logging.log4j.core.LogEvent;
+
+/**
+ * Reads XML {@link LogEvent}s.
+ */
+public class XMLLogEventInput implements LogEventInput {
+
+    @Override
+    public LogEvent readLogEvent(InputStream inputStream) throws IOException {
+        throw new UnsupportedOperationException("Not  implemented yet");
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java?rev=1582188&r1=1582187&r2=1582188&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/AbstractSocketServerTest.java Thu Mar 27 05:16:31 2014
@@ -37,7 +37,9 @@ import org.apache.logging.log4j.core.app
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.appender.SocketAppender;
 import org.apache.logging.log4j.core.filter.AbstractFilter;
+import org.apache.logging.log4j.core.layout.JSONLayout;
 import org.apache.logging.log4j.core.layout.PatternLayout;
+import org.apache.logging.log4j.core.layout.XMLLayout;
 import org.apache.logging.log4j.test.appender.ListAppender;
 import org.junit.After;
 import org.junit.Test;
@@ -60,22 +62,39 @@ public abstract class AbstractSocketServ
     }
 
     private static final String MESSAGE_1 = "This is a test message";
+
     private static final String MESSAGE_2 = "This is test message 2";
 
     private final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+    
+    private final boolean expectLengthException;
 
     private final String port;
-    private final String protocol;
-    private final boolean expectLengthException;
 
+    private final String protocol;
+    
     private final Logger root = ctx.getLogger(AbstractSocketServerTest.class.getSimpleName());
-
+    
     protected AbstractSocketServerTest(final String protocol, final String port, final boolean expectLengthException) {
         this.protocol = protocol;
         this.port = port;
         this.expectLengthException = expectLengthException;
     }
 
+    protected Layout<String> createJsonLayout() {
+        return JSONLayout.createLayout("true", "true", "true", "false", null);
+    }
+
+    protected abstract Layout<? extends Serializable> createLayout();
+
+    protected Layout<? extends Serializable> createSerializedLayout() {
+        return null;
+    }
+
+    protected Layout<String> createXmlLayout() {
+        return XMLLayout.createLayout("true", "true", "true", null, null, null);
+    }
+
     @After
     public void tearDown() {
         final Map<String, Appender> map = root.getAppenders();
@@ -136,10 +155,6 @@ public abstract class AbstractSocketServ
         assertTrue("Incorrect event", events.get(1).getMessage().getFormattedMessage().equals(message2));
     }
 
-    protected Layout<? extends Serializable> createLayout() {
-        return null;
-    }
-
     @Test
     public void testShortMessages() throws Exception {
         testServer(MESSAGE_1, MESSAGE_2);

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpJsonSocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpJsonSocketServerTest.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpJsonSocketServerTest.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpJsonSocketServerTest.java Thu Mar 27 05:16:31 2014
@@ -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.net;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+@Ignore("Not implemented yet")
+public class TcpJsonSocketServerTest extends AbstractSocketServerTest {
+    private static final String PORT = "8198";
+    private static final int PORT_NUM = Integer.parseInt(PORT);
+    private static TCPSocketServer tcpSocketServer;
+
+    private static Thread thread;
+
+    @BeforeClass
+    public static void setupClass() throws Exception {
+        ((LoggerContext) LogManager.getContext(false)).reconfigure();
+        tcpSocketServer = TCPSocketServer.createJsonSocketServer(PORT_NUM);
+        thread = new Thread(tcpSocketServer);
+        thread.start();
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        tcpSocketServer.shutdown();
+        try {
+            thread.join();
+        } catch (final InterruptedException e) {
+            // ignore
+        }
+    }
+
+    public TcpJsonSocketServerTest() {
+        super("tcp", PORT, false);
+    }
+
+    @Override
+    protected Layout<String> createLayout() {
+        return super.createJsonLayout();
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpJsonSocketServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpJsonSocketServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpSerializedSocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpSerializedSocketServerTest.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpSerializedSocketServerTest.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpSerializedSocketServerTest.java Thu Mar 27 05:16:31 2014
@@ -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.net;
+
+import java.io.Serializable;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class TcpSerializedSocketServerTest extends AbstractSocketServerTest {
+    private static final String PORT = "8198";
+    private static final int PORT_NUM = Integer.parseInt(PORT);
+    private static TCPSocketServer tcpSocketServer;
+
+    private static Thread thread;
+
+    @BeforeClass
+    public static void setupClass() throws Exception {
+        ((LoggerContext) LogManager.getContext(false)).reconfigure();
+        tcpSocketServer = TCPSocketServer.createSerializedSocketServer(PORT_NUM);
+        thread = new Thread(tcpSocketServer);
+        thread.start();
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        tcpSocketServer.shutdown();
+        try {
+            thread.join();
+        } catch (final InterruptedException e) {
+            // ignore
+        }
+    }
+
+    public TcpSerializedSocketServerTest() {
+        super("tcp", PORT, false);
+    }
+
+    @Override
+    protected Layout<? extends Serializable> createLayout() {
+        return super.createSerializedLayout();
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpSerializedSocketServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpSerializedSocketServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpXmlSocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpXmlSocketServerTest.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpXmlSocketServerTest.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpXmlSocketServerTest.java Thu Mar 27 05:16:31 2014
@@ -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.net;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+@Ignore("Not implemented yet")
+public class TcpXmlSocketServerTest extends AbstractSocketServerTest {
+    private static final String PORT = "8198";
+    private static final int PORT_NUM = Integer.parseInt(PORT);
+    private static TCPSocketServer tcpSocketServer;
+
+    private static Thread thread;
+
+    @BeforeClass
+    public static void setupClass() throws Exception {
+        ((LoggerContext) LogManager.getContext(false)).reconfigure();
+        tcpSocketServer = TCPSocketServer.createXmlSocketServer(PORT_NUM);
+        thread = new Thread(tcpSocketServer);
+        thread.start();
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        tcpSocketServer.shutdown();
+        try {
+            thread.join();
+        } catch (final InterruptedException e) {
+            // ignore
+        }
+    }
+
+    public TcpXmlSocketServerTest() {
+        super("tcp", PORT, false);
+    }
+
+    @Override
+    protected Layout<String> createLayout() {
+        return super.createXmlLayout();
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpXmlSocketServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/TcpXmlSocketServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpJsonSocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpJsonSocketServerTest.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpJsonSocketServerTest.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpJsonSocketServerTest.java Thu Mar 27 05:16:31 2014
@@ -0,0 +1,63 @@
+/*
+ * 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.net;
+
+import java.io.Serializable;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+@Ignore("Not implemented yet")
+public class UdpJsonSocketServerTest extends AbstractSocketServerTest {
+    private static final String PORT = "8199";
+    private static final int PORT_NUM = Integer.parseInt(PORT);
+    private static Thread thread;
+
+    private static UDPSocketServer udpSocketServer;
+
+    @BeforeClass
+    public static void setupClass() throws Exception {
+        ((LoggerContext) LogManager.getContext(false)).reconfigure();
+        udpSocketServer = UDPSocketServer.createJsonSocketServer(PORT_NUM);
+        thread = new Thread(udpSocketServer);
+        thread.start();
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        udpSocketServer.shutdown();
+        try {
+            thread.join();
+        } catch (final InterruptedException e) {
+            // ignore
+        }
+    }
+
+    public UdpJsonSocketServerTest() {
+        super("udp", PORT, true);
+    }
+
+    @Override
+    protected Layout<? extends Serializable> createLayout() {
+        return super.createJsonLayout();
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpJsonSocketServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpJsonSocketServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpSerializedSocketServerTest.java (from r1582141, logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UDPSocketServerTest.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpSerializedSocketServerTest.java?p2=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpSerializedSocketServerTest.java&p1=logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UDPSocketServerTest.java&r1=1582141&r2=1582188&rev=1582188&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UDPSocketServerTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpSerializedSocketServerTest.java Thu Mar 27 05:16:31 2014
@@ -16,22 +16,25 @@
  */
 package org.apache.logging.log4j.core.net;
 
+import java.io.Serializable;
+
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
-public class UDPSocketServerTest extends AbstractSocketServerTest {
+public class UdpSerializedSocketServerTest extends AbstractSocketServerTest {
     private static final String PORT = "8199";
     private static final int PORT_NUM = Integer.parseInt(PORT);
-    private static UDPSocketServer udpSocketServer;
-
     private static Thread thread;
 
+    private static UDPSocketServer udpSocketServer;
+
     @BeforeClass
     public static void setupClass() throws Exception {
         ((LoggerContext) LogManager.getContext(false)).reconfigure();
-        udpSocketServer = new UDPSocketServer(PORT_NUM);
+        udpSocketServer = UDPSocketServer.createSerializedSocketServer(PORT_NUM);
         thread = new Thread(udpSocketServer);
         thread.start();
     }
@@ -46,8 +49,13 @@ public class UDPSocketServerTest extends
         }
     }
 
-    public UDPSocketServerTest() {
+    public UdpSerializedSocketServerTest() {
         super("udp", PORT, true);
     }
 
+    @Override
+    protected Layout<? extends Serializable> createLayout() {
+        return super.createSerializedLayout();
+    }
+
 }

Added: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpXmlSocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpXmlSocketServerTest.java?rev=1582188&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpXmlSocketServerTest.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpXmlSocketServerTest.java Thu Mar 27 05:16:31 2014
@@ -0,0 +1,63 @@
+/*
+ * 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.net;
+
+import java.io.Serializable;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+@Ignore("Not implemented yet")
+public class UdpXmlSocketServerTest extends AbstractSocketServerTest {
+    private static final String PORT = "8199";
+    private static final int PORT_NUM = Integer.parseInt(PORT);
+    private static Thread thread;
+
+    private static UDPSocketServer udpSocketServer;
+
+    @BeforeClass
+    public static void setupClass() throws Exception {
+        ((LoggerContext) LogManager.getContext(false)).reconfigure();
+        udpSocketServer = UDPSocketServer.createXmlSocketServer(PORT_NUM);
+        thread = new Thread(udpSocketServer);
+        thread.start();
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        udpSocketServer.shutdown();
+        try {
+            thread.join();
+        } catch (final InterruptedException e) {
+            // ignore
+        }
+    }
+
+    public UdpXmlSocketServerTest() {
+        super("udp", PORT, true);
+    }
+
+    @Override
+    protected Layout<? extends Serializable> createLayout() {
+        return super.createXmlLayout();
+    }
+
+}

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpXmlSocketServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/net/UdpXmlSocketServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message