Update code to make it simpler to port similar apps from Log4j 1.
diff --git a/log4j-server/src/main/java/org/apache/logging/log4j/server/AbstractSocketServer.java b/log4j-server/src/main/java/org/apache/logging/log4j/server/AbstractSocketServer.java
index 2024b6b..abddf17 100644
--- a/log4j-server/src/main/java/org/apache/logging/log4j/server/AbstractSocketServer.java
+++ b/log4j-server/src/main/java/org/apache/logging/log4j/server/AbstractSocketServer.java
@@ -70,16 +70,35 @@
@Option(names = {"--classes", "-C"}, description = "Additional classes to allow deserialization")
private List<String> allowedClasses;
+ @Option(names = { "--wire-format", }, description = "Wire format, one of JSON, SERIALIZED, XML; defaults to JSON.")
+ private WireFormat wireFormat = WireFormat.JSON;
+
+ List<String> getAllowedClasses() {
+ return allowedClasses == null ? Collections.<String>emptyList() : allowedClasses;
+ }
+
String getConfigLocation() {
return configLocation;
}
+ boolean getInteractive() {
+ return interactive;
+ }
+
+ InetAddress getLocalBindAddress() {
+ return localBindAddress;
+ }
+
int getPort() {
return port;
}
- protected boolean isInteractive() {
- return interactive;
+ WireFormat getWireFormat() {
+ return wireFormat;
+ }
+
+ void setAllowedClasses(final List<String> allowedClasses) {
+ this.allowedClasses = allowedClasses;
}
void setConfigLocation(final String configLocation) {
@@ -90,24 +109,16 @@
this.interactive = interactive;
}
- void setPort(final int port) {
- this.port = port;
- }
-
- InetAddress getLocalBindAddress() {
- return localBindAddress;
- }
-
void setLocalBindAddress(final InetAddress localBindAddress) {
this.localBindAddress = localBindAddress;
}
- List<String> getAllowedClasses() {
- return allowedClasses == null ? Collections.<String>emptyList() : allowedClasses;
+ void setPort(final int port) {
+ this.port = port;
}
- void setAllowedClasses(final List<String> allowedClasses) {
- this.allowedClasses = allowedClasses;
+ void setWireFormat(final WireFormat wireFormat) {
+ this.wireFormat = Objects.requireNonNull(wireFormat, "wireFormat");
}
}
@@ -178,27 +189,6 @@
this.logEventInput = Objects.requireNonNull(logEventInput, "LogEventInput");
}
- protected boolean isActive() {
- return this.active;
- }
-
- protected void setActive(final boolean isActive) {
- this.active = isActive;
- }
-
- /**
- * Start this server in a new thread.
- *
- * @return the new thread that running this server.
- */
- public Thread startNewThread() {
- final Thread thread = new Log4jThread(this);
- thread.start();
- return thread;
- }
-
- public abstract void shutdown() throws Exception;
-
public void awaitTermination(final Thread serverThread) throws Exception {
final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (true) {
@@ -214,4 +204,25 @@
}
}
+ protected boolean isActive() {
+ return this.active;
+ }
+
+ protected void setActive(final boolean isActive) {
+ this.active = isActive;
+ }
+
+ public abstract void shutdown() throws Exception;
+
+ /**
+ * Start this server in a new thread.
+ *
+ * @return the new thread that running this server.
+ */
+ public Thread startNewThread() {
+ final Thread thread = new Log4jThread(this);
+ thread.start();
+ return thread;
+ }
+
}
diff --git a/log4j-server/src/main/java/org/apache/logging/log4j/server/TcpSocketServer.java b/log4j-server/src/main/java/org/apache/logging/log4j/server/TcpSocketServer.java
index 71e89e1..29d834b 100644
--- a/log4j-server/src/main/java/org/apache/logging/log4j/server/TcpSocketServer.java
+++ b/log4j-server/src/main/java/org/apache/logging/log4j/server/TcpSocketServer.java
@@ -30,20 +30,32 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.apache.logging.log4j.core.parser.ParseException;
-import org.apache.logging.log4j.core.util.Closer;
-import org.apache.logging.log4j.core.util.Log4jThread;
import org.apache.logging.log4j.core.tools.picocli.CommandLine;
import org.apache.logging.log4j.core.tools.picocli.CommandLine.Command;
import org.apache.logging.log4j.core.tools.picocli.CommandLine.Option;
+import org.apache.logging.log4j.core.util.Closer;
+import org.apache.logging.log4j.core.util.Log4jThread;
import org.apache.logging.log4j.message.EntryMessage;
/**
* Listens for Log4j events on a TCP server socket and passes them on to Log4j.
*
- * @param <T>
- * The kind of input stream read
+ * Example JVM command line:
+ *
+ * <pre>
+ * -Dlog4j2.configurationFile=src/test/resources/org/apache/logging/log4j/server/log4j-console-debug.xml
+ * </pre>
+ *
+ * Example class arguments:
+ *
+ * <pre>
+ * --wire-format SERIALIZED
+ * </pre>
+ *
+ * @param <T> The kind of input stream read
* @see #main(String[])
*/
public class TcpSocketServer<T extends InputStream> extends AbstractSocketServer<T> {
@@ -51,7 +63,7 @@
@Command(name = "TcpSocketServer")
protected static class CommandLineArguments extends AbstractSocketServer.CommandLineArguments {
- @Option(names = { "--backlog", "-b" }, description = "Server socket backlog. Must be a positive integer.")
+ @Option(names = {"--backlog", "-b"}, description = "Server socket backlog. Must be a positive integer.")
// Same default as ServerSocket
private int backlog = 50;
@@ -118,146 +130,123 @@
/**
* Creates a socket server that reads JSON log events.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
+ * @param port The port number, or 0 to automatically allocate a port number.
* @return a new a socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @throws IOException if an I/O error occurs when opening the socket.
*/
public static TcpSocketServer<InputStream> createJsonSocketServer(final int port) throws IOException {
LOGGER.entry("createJsonSocketServer", port);
- final TcpSocketServer<InputStream> socketServer = new TcpSocketServer<>(port, new JsonInputStreamLogEventBridge());
+ final TcpSocketServer<InputStream> socketServer = new TcpSocketServer<>(port,
+ new JsonInputStreamLogEventBridge());
return LOGGER.exit(socketServer);
}
/**
* Creates a socket server that reads JSON log events.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
- * @param backlog
- * The server socket backlog.
- * @param localBindAddress
- * The local InetAddress the server will bind to
+ * @param port The port number, or 0 to automatically allocate a port number.
+ * @param backlog The server socket backlog.
+ * @param localBindAddress The local InetAddress the server will bind to
* @return a new a socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @throws IOException if an I/O error occurs when opening the socket.
* @since 2.9
*/
public static TcpSocketServer<InputStream> createJsonSocketServer(final int port, final int backlog,
- final InetAddress localBindAddress) throws IOException {
+ final InetAddress localBindAddress) throws IOException {
LOGGER.entry("createJsonSocketServer", port, backlog, localBindAddress);
final TcpSocketServer<InputStream> socketServer = new TcpSocketServer<>(port, backlog, localBindAddress,
- new JsonInputStreamLogEventBridge());
+ new JsonInputStreamLogEventBridge());
return LOGGER.exit(socketServer);
}
/**
* Creates a socket server that reads serialized log events.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
+ * @param port The port number, or 0 to automatically allocate a port number.
* @return a new a socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @throws IOException if an I/O error occurs when opening the socket.
*/
@Deprecated
public static TcpSocketServer<ObjectInputStream> createSerializedSocketServer(final int port) throws IOException {
LOGGER.entry(port);
- final TcpSocketServer<ObjectInputStream> socketServer = new TcpSocketServer<>(port, new ObjectInputStreamLogEventBridge());
+ final TcpSocketServer<ObjectInputStream> socketServer = new TcpSocketServer<>(port,
+ new ObjectInputStreamLogEventBridge());
return LOGGER.exit(socketServer);
}
/**
* Creates a socket server that reads serialized log events.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
- * @param backlog
- * The server socket backlog.
- * @param localBindAddress
- * The local InetAddress the server will bind to
+ * @param port The port number, or 0 to automatically allocate a port number.
+ * @param backlog The server socket backlog.
+ * @param localBindAddress The local InetAddress the server will bind to
* @return a new a socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @throws IOException if an I/O error occurs when opening the socket.
* @since 2.7
*/
@Deprecated
public static TcpSocketServer<ObjectInputStream> createSerializedSocketServer(final int port, final int backlog,
- final InetAddress localBindAddress) throws IOException {
+ final InetAddress localBindAddress) throws IOException {
return createSerializedSocketServer(port, backlog, localBindAddress, Collections.<String>emptyList());
}
/**
* Creates a socket server that reads serialized log events.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
- * @param backlog
- * The server socket backlog.
- * @param localBindAddress
- * The local InetAddress the server will bind to
+ * @param port The port number, or 0 to automatically allocate a port number.
+ * @param backlog The server socket backlog.
+ * @param localBindAddress The local InetAddress the server will bind to
* @param allowedClasses additional class names to allow for deserialization
* @return a new a socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @throws IOException if an I/O error occurs when opening the socket.
* @since 2.8.2
*/
@Deprecated
- public static TcpSocketServer<ObjectInputStream> createSerializedSocketServer(
- final int port, final int backlog, final InetAddress localBindAddress, final List<String> allowedClasses
- ) throws IOException {
+ public static TcpSocketServer<ObjectInputStream> createSerializedSocketServer(final int port, final int backlog,
+ final InetAddress localBindAddress, final List<String> allowedClasses) throws IOException {
LOGGER.entry(port);
final TcpSocketServer<ObjectInputStream> socketServer = new TcpSocketServer<>(port, backlog, localBindAddress,
- new ObjectInputStreamLogEventBridge(allowedClasses));
+ new ObjectInputStreamLogEventBridge(allowedClasses));
return LOGGER.exit(socketServer);
}
/**
* Creates a socket server that reads XML log events.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
+ * @param port The port number, or 0 to automatically allocate a port number.
* @return a new a socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @throws IOException if an I/O error occurs when opening the socket.
*/
public static TcpSocketServer<InputStream> createXmlSocketServer(final int port) throws IOException {
LOGGER.entry(port);
- final TcpSocketServer<InputStream> socketServer = new TcpSocketServer<>(port, new XmlInputStreamLogEventBridge());
+ final TcpSocketServer<InputStream> socketServer = new TcpSocketServer<>(port,
+ new XmlInputStreamLogEventBridge());
return LOGGER.exit(socketServer);
}
/**
* Creates a socket server that reads XML log events.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
- * @param backlog
- * The server socket backlog.
- * @param localBindAddress
- * The local InetAddress the server will bind to
+ * @param port The port number, or 0 to automatically allocate a port number.
+ * @param backlog The server socket backlog.
+ * @param localBindAddress The local InetAddress the server will bind to
* @return a new a socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @throws IOException if an I/O error occurs when opening the socket.
* @since 2.9
*/
- public static TcpSocketServer<InputStream> createXmlSocketServer(final int port,
- final int backlog, final InetAddress localBindAddress
- ) throws IOException {
+ public static TcpSocketServer<InputStream> createXmlSocketServer(final int port, final int backlog,
+ final InetAddress localBindAddress) throws IOException {
LOGGER.entry(port);
final TcpSocketServer<InputStream> socketServer = new TcpSocketServer<>(port, backlog, localBindAddress,
- new XmlInputStreamLogEventBridge());
+ new XmlInputStreamLogEventBridge());
return LOGGER.exit(socketServer);
}
/**
* Main startup for the server. Run with "--help" for to print command line help on the console.
*
- * @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 {
CommandLineArguments cla = CommandLine.populateCommand(new CommandLineArguments(), args);
@@ -265,13 +254,30 @@
CommandLine.usage(cla, System.err);
return;
}
+ final TcpSocketServer<? extends InputStream> socketServer;
+ switch (cla.getWireFormat()) {
+ case JSON:
+ socketServer = TcpSocketServer.createJsonSocketServer(cla.getPort(), cla.getBacklog(),
+ cla.getLocalBindAddress());
+ break;
+ case SERIALIZED:
+ socketServer = TcpSocketServer.createSerializedSocketServer(cla.getPort(), cla.getBacklog(),
+ cla.getLocalBindAddress());
+ break;
+ case XML:
+ socketServer = TcpSocketServer.createXmlSocketServer(cla.getPort(), cla.getBacklog(),
+ cla.getLocalBindAddress());
+ break;
+ default:
+ CommandLine.usage(cla, System.err);
+ return;
+ }
if (cla.getConfigLocation() != null) {
ConfigurationFactory.setConfigurationFactory(new ServerConfigurationFactory(cla.getConfigLocation()));
}
- final TcpSocketServer<InputStream> socketServer = TcpSocketServer.createJsonSocketServer(
- cla.getPort(), cla.getBacklog(), cla.getLocalBindAddress());
+ LogManager.getLogger().info("Listening on {}", socketServer);
final Thread serverThread = socketServer.startNewThread();
- if (cla.isInteractive()) {
+ if (cla.getInteractive()) {
socketServer.awaitTermination(serverThread);
}
}
@@ -283,32 +289,25 @@
/**
* Constructor.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
- * @param backlog
- * The server socket backlog.
- * @param localBindAddress
- * The local InetAddress the server will bind to
- * @param logEventInput
- * the log even input
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @param port The port number, or 0 to automatically allocate a port number.
+ * @param backlog The server socket backlog.
+ * @param localBindAddress The local InetAddress the server will bind to
+ * @param logEventInput the log even input
+ * @throws IOException if an I/O error occurs when opening the socket.
* @since 2.7
*/
@SuppressWarnings("resource")
- public TcpSocketServer(final int port, final int backlog, final InetAddress localBindAddress, final LogEventBridge<T> logEventInput) throws IOException {
+ public TcpSocketServer(final int port, final int backlog, final InetAddress localBindAddress,
+ final LogEventBridge<T> logEventInput) throws IOException {
this(port, logEventInput, new ServerSocket(port, backlog, localBindAddress));
}
/**
* Constructor.
*
- * @param port
- * The port number, or 0 to automatically allocate a port number.
- * @param logEventInput
- * the log even input
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @param port The port number, or 0 to automatically allocate a port number.
+ * @param logEventInput the log even input
+ * @throws IOException if an I/O error occurs when opening the socket.
*/
@SuppressWarnings("resource")
public TcpSocketServer(final int port, final LogEventBridge<T> logEventInput) throws IOException {
@@ -318,17 +317,11 @@
/**
* Constructor.
*
- * @param port
- * to listen.
- * @param logEventInput
- * the log even input
- * @param serverSocket
- * the socket server
- * @throws IOException
- * if an I/O error occurs when opening the socket.
+ * @param port to listen.
+ * @param logEventInput the log even input
+ * @param serverSocket the socket server
*/
- public TcpSocketServer(final int port, final LogEventBridge<T> logEventInput, final ServerSocket serverSocket)
- throws IOException {
+ public TcpSocketServer(final int port, final LogEventBridge<T> logEventInput, final ServerSocket serverSocket) {
super(port, logEventInput);
this.serverSocket = serverSocket;
}
@@ -389,7 +382,7 @@
public void shutdown() throws IOException {
final EntryMessage entry = logger.traceEntry();
setActive(false);
- //Thread.currentThread().interrupt();
+ // Thread.currentThread().interrupt();
serverSocket.close();
logger.traceExit(entry);
}
@@ -397,6 +390,6 @@
@Override
public String toString() {
return "TcpSocketServer [serverSocket=" + serverSocket + ", handlers=" + handlers + ", logEventInput="
- + logEventInput + "]";
+ + logEventInput + "]";
}
}
diff --git a/log4j-server/src/main/java/org/apache/logging/log4j/server/UdpSocketServer.java b/log4j-server/src/main/java/org/apache/logging/log4j/server/UdpSocketServer.java
index 17a7cdd..b6b4ada 100644
--- a/log4j-server/src/main/java/org/apache/logging/log4j/server/UdpSocketServer.java
+++ b/log4j-server/src/main/java/org/apache/logging/log4j/server/UdpSocketServer.java
@@ -115,7 +115,7 @@
final UdpSocketServer<InputStream> socketServer = UdpSocketServer
.createJsonSocketServer(cla.getPort());
final Thread serverThread = socketServer.startNewThread();
- if (cla.isInteractive()) {
+ if (cla.getInteractive()) {
socketServer.awaitTermination(serverThread);
}
}
diff --git a/log4j-server/src/main/java/org/apache/logging/log4j/server/WireFormat.java b/log4j-server/src/main/java/org/apache/logging/log4j/server/WireFormat.java
new file mode 100644
index 0000000..ff6f078
--- /dev/null
+++ b/log4j-server/src/main/java/org/apache/logging/log4j/server/WireFormat.java
@@ -0,0 +1,28 @@
+/*
+ * 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.server;
+
+/**
+ * Defines the wire format.
+ *
+ * @since 2.14.1
+ */
+public enum WireFormat {
+
+ JSON, SERIALIZED, XML
+}
diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/ExampleLoggingProvider.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/ExampleLoggingProvider.java
new file mode 100644
index 0000000..0bd9d76
--- /dev/null
+++ b/log4j-server/src/test/java/org/apache/logging/log4j/server/ExampleLoggingProvider.java
@@ -0,0 +1,47 @@
+/*
+ * 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.server;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * Example log event provider you can run provided a TCPSocketServer is running first.
+ *
+ * Example JVM command line:
+ *
+ * <pre>
+ * -Dlog4j2.configurationFile=src/test/resources/org/apache/logging/log4j/server/log4j-socket-ser-options.xml -DSocketAppender.port=4664
+ * </pre>
+ */
+public class ExampleLoggingProvider {
+
+ public static void main(String[] args) {
+ Logger logger = LogManager.getLogger();
+ long i = 0;
+ while (true) {
+ logger.info("i = {}", i);
+ i++;
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ }
+}
diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/SslXmlSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/SslXmlSocketServerTest.java
index 42a9e9e..5717a59 100644
--- a/log4j-server/src/test/java/org/apache/logging/log4j/server/SslXmlSocketServerTest.java
+++ b/log4j-server/src/test/java/org/apache/logging/log4j/server/SslXmlSocketServerTest.java
@@ -29,7 +29,6 @@
import org.apache.logging.log4j.core.net.ssl.KeyStoreConfiguration;
import org.apache.logging.log4j.core.net.ssl.SslConfiguration;
import org.apache.logging.log4j.core.net.ssl.StoreConfigurationException;
-import org.apache.logging.log4j.core.net.ssl.TestConstants;
import org.apache.logging.log4j.core.net.ssl.TrustStoreConfiguration;
import org.junit.AfterClass;
import org.junit.BeforeClass;
diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/TestConstants.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/TestConstants.java
new file mode 100644
index 0000000..f537bb4
--- /dev/null
+++ b/log4j-server/src/test/java/org/apache/logging/log4j/server/TestConstants.java
@@ -0,0 +1,48 @@
+/*
+ * 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.server;
+
+public class TestConstants {
+
+ public static final String SOURCE_FOLDER = "src/test/resources/";
+ public static final String RESOURCE_ROOT = "org/apache/logging/log4j/server/ssl/";
+
+ public static final String PATH = SOURCE_FOLDER + RESOURCE_ROOT;
+ public static final String TRUSTSTORE_PATH = PATH;
+ public static final String TRUSTSTORE_RESOURCE = RESOURCE_ROOT;
+ public static final String TRUSTSTORE_FILE = TRUSTSTORE_PATH + "truststore.jks";
+ public static final String TRUSTSTORE_FILE_RESOURCE = TRUSTSTORE_RESOURCE + "truststore.jks";
+
+ public static final char[] TRUSTSTORE_PWD() {
+ return "changeit".toCharArray();
+ }
+
+ public static final String TRUSTSTORE_TYPE = "JKS";
+
+ public static final String KEYSTORE_PATH = PATH;
+ public static final String KEYSTORE_RESOURCE = RESOURCE_ROOT;
+ public static final String KEYSTORE_FILE = KEYSTORE_PATH + "client.log4j2-keystore.jks";
+ public static final String KEYSTORE_FILE_RESOURCE = KEYSTORE_RESOURCE + "client.log4j2-keystore.jks";
+
+ public static final char[] KEYSTORE_PWD() {
+ return "changeit".toCharArray();
+ }
+
+ public static final String KEYSTORE_TYPE = "JKS";
+
+ public static final char[] NULL_PWD = null;
+}
diff --git a/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-console-debug.xml b/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-console-debug.xml
new file mode 100644
index 0000000..6751a52
--- /dev/null
+++ b/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-console-debug.xml
@@ -0,0 +1,33 @@
+<?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="WARN" monitorInterval="5">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <!-- For a color log in the Eclipse console: -->
+ <!-- - Install http://www.mihai-nita.net/eclipse -->
+ <!-- - Use noConsoleNoAnsi="false" -->
+ <PatternLayout noConsoleNoAnsi="false"
+ pattern="%style{%d}{white} %highlight{%-5level}{TRACE=white} %style{[%t]}{yellow}%style{[%logger{1.}]%notEmpty{[%markerSimpleName]}}{white} %highlight{%msg%n%xThrowable}{TRACE=white}" />
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="DEBUG">
+ <AppenderRef ref="Console" />
+ </Root>
+ </Loggers>
+</Configuration>
diff --git a/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-socket-json-options.xml b/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-socket-json-options.xml
new file mode 100644
index 0000000..d721616
--- /dev/null
+++ b/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-socket-json-options.xml
@@ -0,0 +1,33 @@
+<?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="OFF" name="MyApp">
+ <Appenders>
+ <Socket name="socket" host="localhost" port="${sys:SocketAppender.port}" protocol="TCP" ignoreExceptions="false">
+ <JsonLayout properties="true"/>
+ <SocketOptions keepAlive="false" oobInline="false" receiveBufferSize="10000" reuseAddress="false"
+ rfc1349TrafficClass="IPTOS_LOWCOST" sendBufferSize="8000" soLinger="12345" soTimeout="54321" tcpNoDelay="false">
+ <SocketPerformancePreferences bandwidth="100" connectionTime="100" latency="100" />
+ </SocketOptions>
+ </Socket>
+ </Appenders>
+ <Loggers>
+ <Root level="debug">
+ <AppenderRef ref="socket" />
+ </Root>
+ </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-socket-ser-options.xml b/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-socket-ser-options.xml
new file mode 100644
index 0000000..b17acc9
--- /dev/null
+++ b/log4j-server/src/test/resources/org/apache/logging/log4j/server/log4j-socket-ser-options.xml
@@ -0,0 +1,34 @@
+<?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="OFF" name="MyApp">
+ <Appenders>
+ <Socket name="socket" host="localhost" port="${sys:SocketAppender.port}" protocol="TCP"
+ ignoreExceptions="false">
+ <SerializedLayout />
+ <SocketOptions keepAlive="false" oobInline="false" receiveBufferSize="10000" reuseAddress="false"
+ rfc1349TrafficClass="IPTOS_LOWCOST" sendBufferSize="8000" soLinger="12345" soTimeout="54321" tcpNoDelay="false">
+ <SocketPerformancePreferences bandwidth="100" connectionTime="100" latency="100" />
+ </SocketOptions>
+ </Socket>
+ </Appenders>
+ <Loggers>
+ <Root level="debug">
+ <AppenderRef ref="socket" />
+ </Root>
+ </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/client.log4j2-keystore.jks b/log4j-server/src/test/resources/org/apache/logging/log4j/server/ssl/client.log4j2-keystore.jks
similarity index 100%
rename from log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/client.log4j2-keystore.jks
rename to log4j-server/src/test/resources/org/apache/logging/log4j/server/ssl/client.log4j2-keystore.jks
Binary files differ
diff --git a/log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/truststore.jks b/log4j-server/src/test/resources/org/apache/logging/log4j/server/ssl/truststore.jks
similarity index 100%
rename from log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/truststore.jks
rename to log4j-server/src/test/resources/org/apache/logging/log4j/server/ssl/truststore.jks
Binary files differ