http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/AbstractSocketServerTest.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/AbstractSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/AbstractSocketServerTest.java deleted file mode 100644 index dfc44ea..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/AbstractSocketServerTest.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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 java.io.IOException; -import java.io.Serializable; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.core.Appender; -import org.apache.logging.log4j.core.Filter; -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.Logger; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.appender.AppenderLoggingException; -import org.apache.logging.log4j.core.appender.ConsoleAppender; -import org.apache.logging.log4j.core.appender.SocketAppender; -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.core.net.Protocol; -import org.apache.logging.log4j.test.AvailablePortFinder; -import org.apache.logging.log4j.test.appender.ListAppender; -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * - */ -public abstract class AbstractSocketServerTest { - - protected static Thread thread; - - private static final String MESSAGE = "This is test message"; - - private static final String MESSAGE_2 = "This is test message 2"; - - private static final String MESSAGE_WITH_SPECIAL_CHARS = "{This}\n[is]\"n\"a\"\r\ntrue:\n\ttest,\nmessage"; - - static final int PORT_NUM = AvailablePortFinder.getNextAvailable(); - - static final int PORT = PORT_NUM; - - private final LoggerContext ctx = LoggerContext.getContext(false); - - private final boolean expectLengthException; - - protected final int port; - - protected final Protocol protocol; - - private final Logger rootLogger = ctx.getLogger(AbstractSocketServerTest.class.getSimpleName()); - - protected AbstractSocketServerTest(final Protocol protocol, final int port, final boolean expectLengthException) { - this.protocol = protocol; - this.port = port; - this.expectLengthException = expectLengthException; - } - - protected Layout<String> createJsonLayout() { - // @formatter: off - return JsonLayout.newBuilder() - .setLocationInfo(true) - .setProperties(true) - .setPropertiesAsList(false) - .setComplete(false) - .setCompact(false) - .setEventEol(false) - .setIncludeStacktrace(true) - .build(); - // @formatter: on - - //return JsonLayout.createLayout(null, true, true, false, false, false, false, null, null, null, true); - } - - protected abstract Layout<? extends Serializable> createLayout(); - - protected Layout<? extends Serializable> createSerializedLayout() { - return null; - } - - protected Layout<String> createXmlLayout() { - return XmlLayout.createLayout(true, true, false, false, null, true); - } - - @After - public void tearDown() { - final Map<String, Appender> map = rootLogger.getAppenders(); - for (final Map.Entry<String, Appender> entry : map.entrySet()) { - final Appender appender = entry.getValue(); - rootLogger.removeAppender(appender); - appender.stop(); - } - } - - @Test - @Ignore("Broken test?") - public void test1000ShortMessages() throws Exception { - testServer(1000); - } - - @Test - @Ignore("Broken test?") - public void test100ShortMessages() throws Exception { - testServer(100); - } - - @Test - public void test10ShortMessages() throws Exception { - testServer(10); - } - - @Test - public void test1ShortMessages() throws Exception { - testServer(1); - } - - @Test - public void test2ShortMessages() throws Exception { - testServer(2); - } - - @Test - public void test64KBMessages() throws Exception { - final char[] a64K = new char[1024 * 64]; - Arrays.fill(a64K, 'a'); - final String m1 = new String(a64K); - final String m2 = MESSAGE_2 + m1; - if (expectLengthException) { - try { - testServer(m1, m2); - } catch (final AppenderLoggingException are) { - assertTrue("", are.getCause() != null && are.getCause() instanceof IOException); - // Failure expected. - } - } else { - testServer(m1, m2); - } - } - - - @Test - public void testMessagesWithSpecialChars() throws Exception { - testServer(MESSAGE_WITH_SPECIAL_CHARS); - } - - - private void testServer(final int size) throws Exception { - final String[] messages = new String[size]; - for (int i = 0; i < messages.length; i++) { - messages[i] = MESSAGE + " " + i; - } - testServer(messages); - } - - protected void testServer(final String... messages) throws Exception { - final Filter socketFilter = new ThreadNameFilter(Filter.Result.NEUTRAL, Filter.Result.DENY); - final Filter serverFilter = new ThreadNameFilter(Filter.Result.DENY, Filter.Result.NEUTRAL); - final Layout<? extends Serializable> socketLayout = createLayout(); - final SocketAppender socketAppender = createSocketAppender(socketFilter, socketLayout); - socketAppender.start(); - final ListAppender listAppender = new ListAppender("Events", serverFilter, null, false, false); - listAppender.start(); - final PatternLayout layout = PatternLayout.newBuilder().withPattern("%m %ex%n").build(); - final ConsoleAppender console = ConsoleAppender.createDefaultAppenderForLayout(layout); - final Logger serverLogger = ctx.getLogger(this.getClass().getName()); - serverLogger.addAppender(console); - serverLogger.setAdditive(false); - - // set appender on root and set level to debug - rootLogger.addAppender(socketAppender); - rootLogger.addAppender(listAppender); - rootLogger.setAdditive(false); - rootLogger.setLevel(Level.DEBUG); - for (final String message : messages) { - rootLogger.debug(message); - } - final int MAX_TRIES = 400; - for (int i = 0; i < MAX_TRIES; i++) { - if (listAppender.getEvents().size() < messages.length) { - try { - // Let the server-side read the messages. - Thread.sleep(50); - } catch (final Exception e) { - e.printStackTrace(); - } - } else { - break; - } - } - final List<LogEvent> events = listAppender.getEvents(); - assertNotNull("No event retrieved", events); - assertEquals("Incorrect number of events received", messages.length, events.size()); - for (int i = 0; i < messages.length; i++) { - assertTrue("Incorrect event", events.get(i).getMessage().getFormattedMessage().equals(messages[i])); - } - } - - protected SocketAppender createSocketAppender(final Filter socketFilter, - final Layout<? extends Serializable> socketLayout) { - // @formatter:off - return SocketAppender.newBuilder() - .withProtocol(this.protocol) - .withHost("localhost") - .withPort(this.port) - .withReconnectDelayMillis(-1) - .withName("test") - .withImmediateFlush(true) - .withImmediateFail(false) - .withIgnoreExceptions(false) - .withLayout(socketLayout) - .withFilter(socketFilter) - .build(); - // @formatter:on - } - -}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/SslXmlSocketServerTest.java ---------------------------------------------------------------------- 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 deleted file mode 100644 index 1a51244..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/SslXmlSocketServerTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.nio.charset.Charset; - -import org.apache.logging.log4j.core.Filter; -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.appender.SocketAppender; -import org.apache.logging.log4j.core.net.Protocol; -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; - -public class SslXmlSocketServerTest extends AbstractSocketServerTest { - - private static TcpSocketServer<InputStream> server; - - private static SslConfiguration sslConfiguration; - - private static void initServerSocketFactory() throws StoreConfigurationException { - final KeyStoreConfiguration ksc = new KeyStoreConfiguration(TestConstants.KEYSTORE_FILE, - TestConstants.KEYSTORE_PWD, TestConstants.KEYSTORE_TYPE, null); - final TrustStoreConfiguration tsc = new TrustStoreConfiguration(TestConstants.TRUSTSTORE_FILE, - TestConstants.TRUSTSTORE_PWD, null, null); - sslConfiguration = SslConfiguration.createSSLConfiguration(null, ksc, tsc); - } - - @Override - protected SocketAppender createSocketAppender(final Filter socketFilter, - final Layout<? extends Serializable> socketLayout) { - // @formatter:off - return SocketAppender.newBuilder() - .withProtocol(this.protocol) - .withHost("localhost") - .withPort(this.port) - .withReconnectDelayMillis(-1) - .withName("test") - .withImmediateFlush(true) - .withImmediateFail(false) - .withIgnoreExceptions(false) - .withLayout(socketLayout) - .withFilter(socketFilter) - .withSslConfiguration(sslConfiguration) - .build(); - // @formatter:on - } - - @BeforeClass - public static void setupClass() throws Exception { - (LoggerContext.getContext(false)).reconfigure(); - initServerSocketFactory(); - // Use a large buffer just to test the code, the UDP test uses a tiny buffer - server = new SecureTcpSocketServer<>(PORT_NUM, new XmlInputStreamLogEventBridge(1024 * 100, - Charset.defaultCharset()), sslConfiguration); - thread = server.startNewThread(); - } - - @AfterClass - public static void tearDownClass() { - try { - server.shutdown(); - } catch (final IOException e) { - e.printStackTrace(); - } - try { - thread.join(); - } catch (final InterruptedException e) { - // ignore - } - } - - public SslXmlSocketServerTest() { - super(Protocol.SSL, PORT, false); - } - - @Override - protected Layout<String> createLayout() { - return super.createXmlLayout(); - } - -} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpJsonSocketServerTest.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpJsonSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpJsonSocketServerTest.java deleted file mode 100644 index f12c908..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpJsonSocketServerTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 java.io.IOException; -import java.io.InputStream; - -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.net.Protocol; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -public class TcpJsonSocketServerTest extends AbstractSocketServerTest { - - private static TcpSocketServer<InputStream> server; - - @BeforeClass - public static void setupClass() throws Exception { - (LoggerContext.getContext(false)).reconfigure(); - server = TcpSocketServer.createJsonSocketServer(PORT_NUM); - thread = server.startNewThread(); - } - - @AfterClass - public static void tearDownClass() { - try { - server.shutdown(); - } catch (final IOException e) { - e.printStackTrace(); - } - try { - thread.join(); - } catch (final InterruptedException e) { - // ignore - } - } - - public TcpJsonSocketServerTest() { - super(Protocol.TCP, PORT, false); - } - - @Override - protected Layout<String> createLayout() { - return super.createJsonLayout(); - } - -} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpSerializedSocketServerTest.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpSerializedSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpSerializedSocketServerTest.java deleted file mode 100644 index 275af20..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpSerializedSocketServerTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; - -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.net.Protocol; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -public class TcpSerializedSocketServerTest extends AbstractSocketServerTest { - - private static TcpSocketServer<ObjectInputStream> server; - - @BeforeClass - public static void setupClass() throws Exception { - (LoggerContext.getContext(false)).reconfigure(); - server = TcpSocketServer.createSerializedSocketServer(PORT_NUM); - thread = server.startNewThread(); - } - - @AfterClass - public static void tearDownClass() { - try { - server.shutdown(); - } catch (final IOException e) { - e.printStackTrace(); - } - try { - thread.join(); - } catch (final InterruptedException e) { - // ignore - } - } - - public TcpSerializedSocketServerTest() { - super(Protocol.TCP, PORT, false); - } - - @Override - protected Layout<? extends Serializable> createLayout() { - return super.createSerializedLayout(); - } - -} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpXmlSocketServerTest.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpXmlSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpXmlSocketServerTest.java deleted file mode 100644 index 2b2cfd7..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/TcpXmlSocketServerTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; - -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.net.Protocol; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -public class TcpXmlSocketServerTest extends AbstractSocketServerTest { - - private static TcpSocketServer<InputStream> server; - - @BeforeClass - public static void setupClass() throws Exception { - (LoggerContext.getContext(false)).reconfigure(); - // Use a large buffer just to test the code, the UDP test uses a tiny buffer - server = new TcpSocketServer<>(PORT_NUM, new XmlInputStreamLogEventBridge(1024 * 100, - Charset.defaultCharset())); - thread = server.startNewThread(); - } - - @AfterClass - public static void tearDownClass() { - try { - server.shutdown(); - } catch (final IOException e) { - e.printStackTrace(); - } - try { - thread.join(); - } catch (final InterruptedException e) { - // ignore - } - } - - public TcpXmlSocketServerTest() { - super(Protocol.TCP, PORT, false); - } - - @Override - protected Layout<String> createLayout() { - return super.createXmlLayout(); - } - -} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadIdFilter.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadIdFilter.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadIdFilter.java deleted file mode 100644 index d98e3f4..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadIdFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.core.Filter; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.filter.AbstractFilter; - -/** - * TODO Should use thread ID cache? - * @since 2.6 - */ -public class ThreadIdFilter extends AbstractFilter { - - private static final long serialVersionUID = 1L; - - public ThreadIdFilter(final Result onMatch, final Result onMismatch) { - super(onMatch, onMismatch); - } - - @Override - public Filter.Result filter(final LogEvent event) { - return event.getThreadId() == Thread.currentThread().getId() ? onMatch : onMismatch; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadNameFilter.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadNameFilter.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadNameFilter.java deleted file mode 100644 index 4204ac1..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadNameFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.core.Filter; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.filter.AbstractFilter; - -/** - * TODO Should use thread name cache? - */ -public class ThreadNameFilter extends AbstractFilter { - - private static final long serialVersionUID = 1L; - - public ThreadNameFilter(final Result onMatch, final Result onMismatch) { - super(onMatch, onMismatch); - } - - @Override - public Filter.Result filter(final LogEvent event) { - return event.getThreadName().equals(Thread.currentThread().getName()) ? onMatch : onMismatch; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadPriorityFilter.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadPriorityFilter.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadPriorityFilter.java deleted file mode 100644 index 6074f86..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/ThreadPriorityFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.core.Filter; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.filter.AbstractFilter; - -/** - * TODO Should use thread priority cache? - * @since 2.6 - */ -public class ThreadPriorityFilter extends AbstractFilter { - - private static final long serialVersionUID = 1L; - - public ThreadPriorityFilter(final Result onMatch, final Result onMismatch) { - super(onMatch, onMismatch); - } - - @Override - public Filter.Result filter(final LogEvent event) { - return event.getThreadPriority() == Thread.currentThread().getPriority() ? onMatch : onMismatch; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpJsonSocketServerTest.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpJsonSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpJsonSocketServerTest.java deleted file mode 100644 index 7bd36f9..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpJsonSocketServerTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 java.io.InputStream; -import java.io.Serializable; - -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.net.Protocol; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -public class UdpJsonSocketServerTest extends AbstractSocketServerTest { - - private static UdpSocketServer<InputStream> server; - - @BeforeClass - public static void setupClass() throws Exception { - (LoggerContext.getContext(false)).reconfigure(); - server = UdpSocketServer.createJsonSocketServer(PORT_NUM); - thread = server.startNewThread(); - } - - @AfterClass - public static void tearDownClass() { - server.shutdown(); - try { - thread.join(); - } catch (final InterruptedException e) { - // ignore - } - } - - public UdpJsonSocketServerTest() { - super(Protocol.UDP, PORT, true); - } - - @Override - protected Layout<? extends Serializable> createLayout() { - return super.createJsonLayout(); - } - -} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpSerializedSocketServerTest.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpSerializedSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpSerializedSocketServerTest.java deleted file mode 100644 index 9c806af..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpSerializedSocketServerTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 java.io.ObjectInputStream; -import java.io.Serializable; - -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.net.Protocol; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; - -@Ignore -public class UdpSerializedSocketServerTest extends AbstractSocketServerTest { - - private static UdpSocketServer<ObjectInputStream> server; - - @BeforeClass - public static void setupClass() throws Exception { - (LoggerContext.getContext(false)).reconfigure(); - server = UdpSocketServer.createSerializedSocketServer(PORT_NUM); - thread = server.startNewThread(); - } - - @AfterClass - public static void tearDownClass() { - server.shutdown(); - try { - thread.join(); - } catch (final InterruptedException e) { - // ignore - } - } - - public UdpSerializedSocketServerTest() { - super(Protocol.UDP, PORT, true); - } - - @Override - protected Layout<? extends Serializable> createLayout() { - return super.createSerializedLayout(); - } - -} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpXmlSocketServerTest.java ---------------------------------------------------------------------- diff --git a/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpXmlSocketServerTest.java b/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpXmlSocketServerTest.java deleted file mode 100644 index 0299312..0000000 --- a/log4j-server/src/test/java/org/apache/logging/log4j/server/UdpXmlSocketServerTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 java.io.InputStream; -import java.io.Serializable; -import java.nio.charset.Charset; - -import org.apache.logging.log4j.core.Layout; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.net.Protocol; -import org.junit.AfterClass; -import org.junit.BeforeClass; - -public class UdpXmlSocketServerTest extends AbstractSocketServerTest { - - private static UdpSocketServer<InputStream> server; - - @BeforeClass - public static void setupClass() throws Exception { - (LoggerContext.getContext(false)).reconfigure(); - // Use a tiny buffer just to test the code, the TCP test uses a large buffer - server = new UdpSocketServer<>(PORT_NUM, new XmlInputStreamLogEventBridge(100, - Charset.defaultCharset())); - thread = server.startNewThread(); - } - - @AfterClass - public static void tearDownClass() { - server.shutdown(); - try { - thread.join(); - } catch (final InterruptedException e) { - // ignore - } - } - - public UdpXmlSocketServerTest() { - super(Protocol.UDP, PORT, true); - } - - @Override - protected Layout<? extends Serializable> createLayout() { - return super.createXmlLayout(); - } - -} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/client.log4j2-keystore.jks ---------------------------------------------------------------------- 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/core/net/ssl/client.log4j2-keystore.jks deleted file mode 100644 index 36f11b6..0000000 Binary files a/log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/client.log4j2-keystore.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/truststore.jks ---------------------------------------------------------------------- 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/core/net/ssl/truststore.jks deleted file mode 100644 index 0e6aaf2..0000000 Binary files a/log4j-server/src/test/resources/org/apache/logging/log4j/core/net/ssl/truststore.jks and /dev/null differ http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index de0d960..ab5ac19 100644 --- a/pom.xml +++ b/pom.xml @@ -356,11 +356,6 @@ </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-server</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-jul</artifactId> <version>${project.version}</version> </dependency> @@ -1279,7 +1274,6 @@ <module>log4j-web</module> <module>log4j-perf</module> <module>log4j-iostreams</module> - <module>log4j-server</module> <module>log4j-jul</module> <module>log4j-liquibase</module> <module>log4j-api-scala_2.10</module> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8865124f/src/site/xdoc/runtime-dependencies.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/runtime-dependencies.xml b/src/site/xdoc/runtime-dependencies.xml index 4f5d410..e6de8c7 100644 --- a/src/site/xdoc/runtime-dependencies.xml +++ b/src/site/xdoc/runtime-dependencies.xml @@ -257,20 +257,6 @@ This only requires the Log4j API. </p> - <a name="log4j-server" /> - <h4>log4j-server</h4> - <table> - <caption align="top">Optional Dependencies per Feature in Log4J Server components</caption> - <tr> - <th>Feature</th> - <th>Requirements</th> - </tr> - <tr> - <td>JMS receivers</td> - <td>a JMS broker like <a href="http://activemq.apache.org/">Apache ActiveMQ</a></td> - </tr> - </table> - <a name="log4j-api-scala" /> <h4>log4j-api-scala</h4> <p>
