@@ -120,18 +95,9 @@
**/*Tests.java
- -Djdk.attach.allowAttachSelf=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager
+ -Djava.util.logging.manager=org.jboss.logmanager.LogManager
org.jboss.logmanager.LogManager
- ${project.build.directory}${file.separator}logs${file.separator}
-
- ${project.basedir}/src/test/resources/server-keystore.jks
- testpassword
- ${project.basedir}/src/test/resources/client-keystore.jks
- testpassword
- ${org.jboss.test.address}
- ${org.jboss.test.port}
- ${org.jboss.test.alt.port}
false
diff --git a/core/src/main/java/org/jboss/logmanager/ExtHandler.java b/core/src/main/java/org/jboss/logmanager/ExtHandler.java
index 58f69937..20806c43 100644
--- a/core/src/main/java/org/jboss/logmanager/ExtHandler.java
+++ b/core/src/main/java/org/jboss/logmanager/ExtHandler.java
@@ -19,6 +19,7 @@
package org.jboss.logmanager;
+import java.io.Flushable;
import java.io.UnsupportedEncodingException;
import java.security.Permission;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
@@ -31,13 +32,12 @@
import java.util.logging.LoggingPermission;
import org.jboss.logmanager.errormanager.OnlyOnceErrorManager;
-import org.jboss.logmanager.handlers.FlushableCloseable;
/**
* An extended logger handler. Use this class as a base class for log handlers which require {@code ExtLogRecord}
* instances.
*/
-public abstract class ExtHandler extends Handler implements FlushableCloseable {
+public abstract class ExtHandler extends Handler implements AutoCloseable, Flushable {
private static final Permission CONTROL_PERMISSION = new LoggingPermission("control", null);
private volatile boolean autoFlush = true;
diff --git a/core/src/main/java/org/jboss/logmanager/LogContextSelectorService.java b/core/src/main/java/org/jboss/logmanager/LogContextSelectorService.java
deleted file mode 100644
index 55d12e50..00000000
--- a/core/src/main/java/org/jboss/logmanager/LogContextSelectorService.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- *
- * Copyright 2014 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed 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.jboss.logmanager;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * A container-friendly service which will manage the installation of a
- * {@link LogContextSelector} into the log system. Only one such service
- * may be active at a time, or an error will result.
- */
-public final class LogContextSelectorService {
- private LogContextSelector selector;
- private static final AtomicBoolean oneInstalled = new AtomicBoolean();
-
- /**
- * Get the selector to install.
- *
- * @return the selector
- */
- public LogContextSelector getSelector() {
- return selector;
- }
-
- /**
- * Set the selector to install.
- *
- * @param selector the selector
- */
- public void setSelector(final LogContextSelector selector) {
- this.selector = selector;
- }
-
- /**
- * Install the selector.
- */
- public void start() {
- if (oneInstalled.getAndSet(true)) {
- throw new IllegalStateException("A log context selector is already installed");
- }
- LogContext.setLogContextSelector(selector);
- }
-
- /**
- * Uninstall the selector.
- */
- public void stop() {
- if (oneInstalled.getAndSet(false)) {
- LogContext.setLogContextSelector(LogContext.DEFAULT_LOG_CONTEXT_SELECTOR);
- }
- }
-}
diff --git a/core/src/main/java/org/jboss/logmanager/LogService.java b/core/src/main/java/org/jboss/logmanager/LogService.java
deleted file mode 100644
index ad9e17f9..00000000
--- a/core/src/main/java/org/jboss/logmanager/LogService.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- *
- * Copyright 2014 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed 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.jboss.logmanager;
-
-import java.util.logging.Handler;
-
-/**
- * A simple log service which can be used to remove any bootstrap handlers when a real handler is configured.
- */
-public final class LogService {
-
- private static final Logger log = Logger.getLogger("org.jboss.logging.service");
- private static final Logger rootLogger = Logger.getLogger("");
-
- private Handler[] bootstrapHandlers;
-
- /**
- * Create lifecycle method.
- */
- public void create() {
- }
-
- /**
- * Start method; removes and saves bootstrap handlers.
- */
- public void start() {
- log.info("Removing bootstrap log handlers");
- final Handler[] bootstrapHandlers = rootLogger.clearHandlers();
- this.bootstrapHandlers = bootstrapHandlers;
- for (Handler handler : bootstrapHandlers) {
- safeFlush(handler);
- }
- // this message probably won't appear anywhere...
- log.info("Removed bootstrap log handlers");
- }
-
- /**
- * Stop method; removes root handlers and restores the bootstrap handlers.
- */
- public void stop() {
- // this message probably won't appear anywhere...
- log.info("Restoring bootstrap log handlers");
- // clear any remaining handlers from the root (there shouldn't be any, but...)
- for (Handler handler : rootLogger.clearHandlers()) {
- safeClose(handler);
- }
- final Handler[] bootstrapHandlers = this.bootstrapHandlers;
- this.bootstrapHandlers = null;
- for (Handler handler : bootstrapHandlers) {
- rootLogger.addHandler(handler);
- }
- log.info("Restored bootstrap log handlers");
- }
-
- private static void safeFlush(Handler handler) {
- try {
- if (handler != null) handler.flush();
- } catch (Throwable t) {
- // todo - might this loop somehow?
- log.log(Level.ERROR, "Error flushing a log handler", t);
- }
- }
-
- private static void safeClose(Handler handler) {
- try {
- if (handler != null) handler.close();
- } catch (Throwable t) {
- // todo - might this loop somehow?
- log.log(Level.ERROR, "Error closing a log handler", t);
- }
- }
-
- /**
- * Destroy lifecycle method.
- */
- public void destroy() {
- }
-}
\ No newline at end of file
diff --git a/core/src/main/java/org/jboss/logmanager/LoggingUncaughtExceptionHandler.java b/core/src/main/java/org/jboss/logmanager/LoggingUncaughtExceptionHandler.java
deleted file mode 100644
index 756c7905..00000000
--- a/core/src/main/java/org/jboss/logmanager/LoggingUncaughtExceptionHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- *
- * Copyright 2014 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed 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.jboss.logmanager;
-
-/**
- * Logging uncaught exception handler.
- */
-public final class LoggingUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
-
- private final Logger log;
-
- /**
- * Create a new instance.
- *
- * @param log the logger to log the uncaught exception to
- */
- public LoggingUncaughtExceptionHandler(final Logger log) {
- this.log = log;
- }
-
- /**
- * Method invoked when the given thread terminates due to the given uncaught exception. Any exception thrown by this
- * method will be ignored by the Java Virtual Machine.
- *
- * @param t the thread
- * @param e the exception
- */
- public void uncaughtException(final Thread t, final Throwable e) {
- log.log(Level.ERROR, "Uncaught exception", e);
- }
-}
diff --git a/core/src/main/java/org/jboss/logmanager/formatters/StackTraceFormatter.java b/core/src/main/java/org/jboss/logmanager/formatters/StackTraceFormatter.java
index 7de111eb..ed405d57 100644
--- a/core/src/main/java/org/jboss/logmanager/formatters/StackTraceFormatter.java
+++ b/core/src/main/java/org/jboss/logmanager/formatters/StackTraceFormatter.java
@@ -38,7 +38,7 @@
*
* @author James R. Perkins
*/
-class StackTraceFormatter {
+public class StackTraceFormatter {
private static final String CAUSED_BY_CAPTION = "Caused by: ";
private static final String SUPPRESSED_CAPTION = "Suppressed: ";
// Used to guard against reentry when attempting to guess the class name
@@ -58,6 +58,17 @@ private StackTraceFormatter(final StringBuilder builder, final int suppressedDep
cache = extended ? new HashMap() : null;
}
+ /**
+ * Writes the stack trace into the builder.
+ *
+ * @param builder the string builder ot append the stack trace to
+ * @param t the throwable to render
+ * @param suppressedDepth the number of suppressed messages to include
+ */
+ public static void renderStackTrace(final StringBuilder builder, final Throwable t, final int suppressedDepth) {
+ renderStackTrace(builder, t, false, suppressedDepth);
+ }
+
/**
* Writes the stack trace into the builder.
*
diff --git a/core/src/main/java/org/jboss/logmanager/formatters/StringBuilderWriter.java b/core/src/main/java/org/jboss/logmanager/formatters/StringBuilderWriter.java
index c1d8b799..d9e69187 100644
--- a/core/src/main/java/org/jboss/logmanager/formatters/StringBuilderWriter.java
+++ b/core/src/main/java/org/jboss/logmanager/formatters/StringBuilderWriter.java
@@ -21,11 +21,11 @@
import java.io.Writer;
-final class StringBuilderWriter extends Writer {
+public final class StringBuilderWriter extends Writer {
private final StringBuilder builder;
- StringBuilderWriter() {
+ public StringBuilderWriter() {
this(new StringBuilder());
}
@@ -38,7 +38,7 @@ public StringBuilderWriter(final StringBuilder builder) {
*
* @see StringBuilder#setLength(int)
*/
- void clear() {
+ public void clear() {
builder.setLength(0);
}
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/FlushableCloseable.java b/core/src/main/java/org/jboss/logmanager/handlers/FlushableCloseable.java
deleted file mode 100644
index cf911afb..00000000
--- a/core/src/main/java/org/jboss/logmanager/handlers/FlushableCloseable.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- *
- * Copyright 2014 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed 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.jboss.logmanager.handlers;
-
-import java.io.Flushable;
-import java.io.Closeable;
-
-/**
- * A resource which is flushable and closeable.
- */
-public interface FlushableCloseable extends Flushable, Closeable {}
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/Handlers.java b/core/src/main/java/org/jboss/logmanager/handlers/Handlers.java
deleted file mode 100644
index 6fd3b446..00000000
--- a/core/src/main/java/org/jboss/logmanager/handlers/Handlers.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- *
- * Copyright 2014 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed 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.jboss.logmanager.handlers;
-
-import java.util.logging.Handler;
-
-/**
- * Handler utility methods.
- */
-public final class Handlers {
-
- private Handlers() {
- }
-
- /**
- * Create a wrapper that exposes the handler's close and flush methods via the I/O API.
- *
- * @param handler the logging handler
- * @return the wrapper
- */
- public static FlushableCloseable wrap(final Handler handler) {
- return handler instanceof FlushableCloseable ? (FlushableCloseable) handler : new FlushableCloseable() {
- public void close() {
- handler.close();
- }
-
- public void flush() {
- handler.flush();
- }
- };
- }
-
- /**
- * Create a {@code Runnable} task that flushes a handler.
- *
- * @param handler the handler
- * @return a flushing task
- */
- public static Runnable flusher(final Handler handler) {
- return new Runnable() {
- public void run() {
- handler.flush();
- }
- };
- }
-}
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/NullHandler.java b/core/src/main/java/org/jboss/logmanager/handlers/NullHandler.java
deleted file mode 100644
index 2c741115..00000000
--- a/core/src/main/java/org/jboss/logmanager/handlers/NullHandler.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- *
- * Copyright 2014 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
- *
- * Licensed 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.jboss.logmanager.handlers;
-
-import org.jboss.logmanager.ExtHandler;
-
-/**
- * A handler which performs no action other than to run any attached filter.
- */
-public final class NullHandler extends ExtHandler {
-}
diff --git a/core/src/main/java9/org/jboss/logmanager/formatters/StackTraceFormatter.java b/core/src/main/java9/org/jboss/logmanager/formatters/StackTraceFormatter.java
index 78d63c63..e6fb79a8 100644
--- a/core/src/main/java9/org/jboss/logmanager/formatters/StackTraceFormatter.java
+++ b/core/src/main/java9/org/jboss/logmanager/formatters/StackTraceFormatter.java
@@ -27,7 +27,7 @@
*
* @author James R. Perkins
*/
-class StackTraceFormatter {
+public class StackTraceFormatter {
private static final String CAUSED_BY_CAPTION = "Caused by: ";
private static final String SUPPRESSED_CAPTION = "Suppressed: ";
@@ -41,6 +41,17 @@ private StackTraceFormatter(final StringBuilder builder, final int suppressedDep
this.suppressedDepth = suppressedDepth;
}
+ /**
+ * Writes the stack trace into the builder.
+ *
+ * @param builder the string builder ot append the stack trace to
+ * @param t the throwable to render
+ * @param suppressedDepth the number of suppressed messages to include
+ */
+ public static void renderStackTrace(final StringBuilder builder, final Throwable t, final int suppressedDepth) {
+ renderStackTrace(builder, t, false, suppressedDepth);
+ }
+
/**
* Writes the stack trace into the builder.
*
diff --git a/core/src/test/java/org/jboss/logmanager/HandlerTests.java b/core/src/test/java/org/jboss/logmanager/HandlerTests.java
index db8a19a3..541e9daa 100644
--- a/core/src/test/java/org/jboss/logmanager/HandlerTests.java
+++ b/core/src/test/java/org/jboss/logmanager/HandlerTests.java
@@ -23,7 +23,6 @@
import static org.junit.Assert.*;
import org.jboss.logmanager.handlers.WriterHandler;
import org.jboss.logmanager.handlers.OutputStreamHandler;
-import org.jboss.logmanager.handlers.NullHandler;
import org.jboss.logmanager.handlers.FileHandler;
import org.jboss.logmanager.formatters.PatternFormatter;
@@ -43,7 +42,7 @@ public final class HandlerTests {
@Test
public void testNullHandler() throws Throwable {
- final NullHandler handler = new NullHandler();
+ final ExtHandler handler = new ExtHandler(){};
handler.setLevel(Level.ALL);
handler.publish(new ExtLogRecord(Level.INFO, "Test message", null));
}
diff --git a/core/src/test/java/org/jboss/logmanager/TestLogContextConfigurator.java b/core/src/test/java/org/jboss/logmanager/TestLogContextConfigurator.java
index d0e4eafd..3231410f 100644
--- a/core/src/test/java/org/jboss/logmanager/TestLogContextConfigurator.java
+++ b/core/src/test/java/org/jboss/logmanager/TestLogContextConfigurator.java
@@ -21,11 +21,14 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.StringWriter;
import java.io.UncheckedIOException;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.json.Json;
+import javax.json.stream.JsonGenerator;
-import org.jboss.logmanager.formatters.JsonFormatter;
import org.jboss.logmanager.handlers.FileHandler;
/**
@@ -60,7 +63,7 @@ private static void configure(final LogContext logContext) {
final String fileName = System.getProperty("test.log.file.name");
final FileHandler handler = new FileHandler(fileName, false);
handler.setAutoFlush(true);
- handler.setFormatter(new JsonFormatter());
+ handler.setFormatter(new TestFormatter());
rootLogger.addHandler(handler);
rootLogger.setLevel(Level.INFO);
} catch (IOException e) {
@@ -68,4 +71,28 @@ private static void configure(final LogContext logContext) {
}
}
}
+
+ private static class TestFormatter extends ExtFormatter {
+
+ @Override
+ public String format(final ExtLogRecord record) {
+ StringWriter stringWriter = new StringWriter();
+ try (JsonGenerator generator = Json.createGenerator(stringWriter)) {
+ generator.writeStartObject();
+
+ generator.write("loggerClassName", record.getLoggerClassName());
+ generator.write("level", record.getLevel().toString());
+ generator.write("message", record.getMessage());
+ generator.writeStartObject("mdc");
+ final Map mdc = record.getMdcCopy();
+ mdc.forEach(generator::write);
+ generator.writeEnd(); // end MDC
+
+ generator.writeEnd(); // end object
+ generator.flush();
+ stringWriter.write(System.lineSeparator());
+ return stringWriter.toString();
+ }
+ }
+ }
}
diff --git a/ext/pom.xml b/ext/pom.xml
index b2f6373d..1e6c5047 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -31,6 +31,19 @@
jboss-logmanager-ext
+
+ javax.json
+ javax.json-api
+
+ true
+
+
+
+ org.glassfish
+ javax.json
+
+ true
+
org.jboss.logging
jboss-logging
@@ -57,6 +70,26 @@
+
+ org.jboss.byteman
+ byteman
+ test
+
+
+ org.jboss.byteman
+ byteman-submit
+ test
+
+
+ org.jboss.byteman
+ byteman-install
+ test
+
+
+ org.jboss.byteman
+ byteman-bmunit
+ test
+
junit
junit
@@ -69,9 +102,19 @@
maven-surefire-plugin
+ -Djdk.attach.allowAttachSelf=true
+
+ ${project.basedir}/src/test/resources/server-keystore.jks
+ testpassword
+ ${project.basedir}/src/test/resources/client-keystore.jks
+ testpassword
+
${project.build.testOutputDirectory}${file.separator}configs
${project.build.directory}${file.separator}logs
+ ${org.jboss.test.address}
+ ${org.jboss.test.port}
+ ${org.jboss.test.alt.port}
diff --git a/core/src/main/java/org/jboss/logmanager/PropertyValues.java b/ext/src/main/java/org/jboss/logmanager/ext/PropertyValues.java
similarity index 99%
rename from core/src/main/java/org/jboss/logmanager/PropertyValues.java
rename to ext/src/main/java/org/jboss/logmanager/ext/PropertyValues.java
index e6afe1fd..9ab61a4f 100644
--- a/core/src/main/java/org/jboss/logmanager/PropertyValues.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/PropertyValues.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager;
+package org.jboss.logmanager.ext;
import java.util.Collections;
import java.util.EnumMap;
diff --git a/core/src/main/java/org/jboss/logmanager/formatters/IndentingXmlWriter.java b/ext/src/main/java/org/jboss/logmanager/ext/formatters/IndentingXmlWriter.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/formatters/IndentingXmlWriter.java
rename to ext/src/main/java/org/jboss/logmanager/ext/formatters/IndentingXmlWriter.java
index e5eb438c..37ddcc68 100644
--- a/core/src/main/java/org/jboss/logmanager/formatters/IndentingXmlWriter.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/formatters/IndentingXmlWriter.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.formatters;
+package org.jboss.logmanager.ext.formatters;
import java.util.Iterator;
import java.util.NoSuchElementException;
diff --git a/core/src/main/java/org/jboss/logmanager/formatters/JsonFormatter.java b/ext/src/main/java/org/jboss/logmanager/ext/formatters/JsonFormatter.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/formatters/JsonFormatter.java
rename to ext/src/main/java/org/jboss/logmanager/ext/formatters/JsonFormatter.java
index 6d52d39e..67f1c7f9 100644
--- a/core/src/main/java/org/jboss/logmanager/formatters/JsonFormatter.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/formatters/JsonFormatter.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.formatters;
+package org.jboss.logmanager.ext.formatters;
import java.io.Writer;
import java.math.BigDecimal;
@@ -29,7 +29,7 @@
import javax.json.stream.JsonGenerator;
import javax.json.stream.JsonGeneratorFactory;
-import org.jboss.logmanager.PropertyValues;
+import org.jboss.logmanager.ext.PropertyValues;
/**
* A formatter that outputs the record into JSON format optionally printing details.
diff --git a/core/src/main/java/org/jboss/logmanager/formatters/StructuredFormatter.java b/ext/src/main/java/org/jboss/logmanager/ext/formatters/StructuredFormatter.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/formatters/StructuredFormatter.java
rename to ext/src/main/java/org/jboss/logmanager/ext/formatters/StructuredFormatter.java
index 562ccba2..04af56e8 100644
--- a/core/src/main/java/org/jboss/logmanager/formatters/StructuredFormatter.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/formatters/StructuredFormatter.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.formatters;
+package org.jboss.logmanager.ext.formatters;
import java.io.Writer;
import java.time.Instant;
@@ -31,11 +31,13 @@
import org.jboss.logmanager.ExtFormatter;
import org.jboss.logmanager.ExtLogRecord;
-import org.jboss.logmanager.PropertyValues;
+import org.jboss.logmanager.ext.PropertyValues;
+import org.jboss.logmanager.formatters.StackTraceFormatter;
+import org.jboss.logmanager.formatters.StringBuilderWriter;
/**
* An abstract class that uses a generator to help generate structured data from a {@link
- * org.jboss.logmanager.ExtLogRecord record}.
+ * ExtLogRecord record}.
*
* Note that including details can be expensive in terms of calculating the caller.
*
@@ -248,7 +250,7 @@ public final synchronized String format(final ExtLogRecord record) {
if (isFormattedExceptionOutputType()) {
final StringBuilder sb = new StringBuilder();
- StackTraceFormatter.renderStackTrace(sb, thrown, false, -1);
+ StackTraceFormatter.renderStackTrace(sb, thrown, -1);
generator.add(getKey(Key.STACK_TRACE), sb.toString());
}
}
@@ -358,7 +360,7 @@ public synchronized DateTimeFormatter getDateTimeFormatter() {
/**
* Sets the pattern to use when formatting the date. The pattern must be a valid
- * {@link java.time.format.DateTimeFormatter#ofPattern(String)} pattern.
+ * {@link DateTimeFormatter#ofPattern(String)} pattern.
*
* If the pattern is {@code null} a default {@linkplain DateTimeFormatter#ISO_OFFSET_DATE_TIME formatter} will be
* used. The {@linkplain #setZoneId(String) zone id} will always be appended to the formatter. By default the zone
diff --git a/core/src/main/java/org/jboss/logmanager/formatters/XmlFormatter.java b/ext/src/main/java/org/jboss/logmanager/ext/formatters/XmlFormatter.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/formatters/XmlFormatter.java
rename to ext/src/main/java/org/jboss/logmanager/ext/formatters/XmlFormatter.java
index 48d955a0..abd74c8a 100644
--- a/core/src/main/java/org/jboss/logmanager/formatters/XmlFormatter.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/formatters/XmlFormatter.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.formatters;
+package org.jboss.logmanager.ext.formatters;
import java.io.Writer;
import java.util.Map;
@@ -25,7 +25,7 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-import org.jboss.logmanager.PropertyValues;
+import org.jboss.logmanager.ext.PropertyValues;
/**
* A formatter that outputs the record in XML format.
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/AsyncHandler.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/AsyncHandler.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/handlers/AsyncHandler.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/AsyncHandler.java
index 94431018..ac19c110 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/AsyncHandler.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/AsyncHandler.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,18 +17,18 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-import org.jboss.logmanager.ExtLogRecord;
-import org.jboss.logmanager.ExtHandler;
-import java.util.concurrent.ThreadFactory;
import java.util.concurrent.Executors;
-
-import java.util.logging.Handler;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.logging.ErrorManager;
+import java.util.logging.Handler;
+
+import org.jboss.logmanager.ExtHandler;
+import org.jboss.logmanager.ExtLogRecord;
/**
* An asynchronous log handler which is used to write to a handler or group of handlers which are "slow" or introduce
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/ByteStringBuilder.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/ByteStringBuilder.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/handlers/ByteStringBuilder.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/ByteStringBuilder.java
index b87ae073..3459c4de 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/ByteStringBuilder.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/ByteStringBuilder.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.util.Arrays;
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/ClientSocketFactory.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/ClientSocketFactory.java
similarity index 99%
rename from core/src/main/java/org/jboss/logmanager/handlers/ClientSocketFactory.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/ClientSocketFactory.java
index 7e8d1503..4afeb64f 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/ClientSocketFactory.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/ClientSocketFactory.java
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.IOException;
import java.net.DatagramSocket;
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/CountingOutputStream.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/CountingOutputStream.java
similarity index 93%
rename from core/src/main/java/org/jboss/logmanager/handlers/CountingOutputStream.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/CountingOutputStream.java
index e50f1650..477e99c9 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/CountingOutputStream.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/CountingOutputStream.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.IOException;
import java.io.OutputStream;
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/PeriodicRotatingFileHandler.java
similarity index 95%
rename from core/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/PeriodicRotatingFileHandler.java
index b5822c11..323f1407 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/PeriodicRotatingFileHandler.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.File;
import java.io.FileNotFoundException;
@@ -29,6 +29,7 @@
import java.util.logging.ErrorManager;
import org.jboss.logmanager.ExtLogRecord;
+import org.jboss.logmanager.handlers.FileHandler;
/**
* A file handler which rotates the log at a preset time interval. The interval is determined by the content of the
@@ -54,7 +55,7 @@ public PeriodicRotatingFileHandler() {
*
* @param fileName the file name
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicRotatingFileHandler(final String fileName) throws FileNotFoundException {
super(fileName);
@@ -66,7 +67,7 @@ public PeriodicRotatingFileHandler(final String fileName) throws FileNotFoundExc
* @param fileName the file name
* @param append {@code true} to append, {@code false} to overwrite
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicRotatingFileHandler(final String fileName, final boolean append) throws FileNotFoundException {
super(fileName, append);
@@ -78,7 +79,7 @@ public PeriodicRotatingFileHandler(final String fileName, final boolean append)
* @param file the file
* @param suffix the format suffix to use
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicRotatingFileHandler(final File file, final String suffix) throws FileNotFoundException {
super(file);
@@ -91,7 +92,7 @@ public PeriodicRotatingFileHandler(final File file, final String suffix) throws
* @param file the file
* @param suffix the format suffix to use
* @param append {@code true} to append, {@code false} to overwrite
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicRotatingFileHandler(final File file, final String suffix, final boolean append) throws FileNotFoundException {
super(file, append);
@@ -118,7 +119,7 @@ protected void preWrite(final ExtLogRecord record) {
}
/**
- * Set the suffix string. The string is in a format which can be understood by {@link java.text.SimpleDateFormat}.
+ * Set the suffix string. The string is in a format which can be understood by {@link SimpleDateFormat}.
* The period of the rotation is automatically calculated based on the suffix.
*
* If the suffix ends with {@code .gz} or {@code .zip} the file will be compressed on rotation.
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/PeriodicSizeRotatingFileHandler.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/PeriodicSizeRotatingFileHandler.java
similarity index 92%
rename from core/src/main/java/org/jboss/logmanager/handlers/PeriodicSizeRotatingFileHandler.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/PeriodicSizeRotatingFileHandler.java
index 0ac01c52..627e581b 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/PeriodicSizeRotatingFileHandler.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/PeriodicSizeRotatingFileHandler.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.File;
import java.io.FileNotFoundException;
@@ -56,7 +56,7 @@ public PeriodicSizeRotatingFileHandler() {
*
* @param fileName the file name
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicSizeRotatingFileHandler(final String fileName) throws FileNotFoundException {
super(fileName);
@@ -68,7 +68,7 @@ public PeriodicSizeRotatingFileHandler(final String fileName) throws FileNotFoun
* @param fileName the file name
* @param append {@code true} to append, {@code false} to overwrite
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicSizeRotatingFileHandler(final String fileName, final boolean append) throws FileNotFoundException {
super(fileName, append);
@@ -80,7 +80,7 @@ public PeriodicSizeRotatingFileHandler(final String fileName, final boolean appe
* @param file the file
* @param suffix the format suffix to use
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicSizeRotatingFileHandler(final File file, final String suffix) throws FileNotFoundException {
super(file, suffix);
@@ -93,7 +93,7 @@ public PeriodicSizeRotatingFileHandler(final File file, final String suffix) thr
* @param suffix the format suffix to use
* @param append {@code true} to append, {@code false} to overwrite
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicSizeRotatingFileHandler(final File file, final String suffix, final boolean append) throws FileNotFoundException {
super(file, suffix, append);
@@ -107,7 +107,7 @@ public PeriodicSizeRotatingFileHandler(final File file, final String suffix, fin
* @param rotateSize the size the file should rotate at
* @param maxBackupIndex the maximum number of files to backup
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicSizeRotatingFileHandler(final File file, final String suffix, final long rotateSize, final int maxBackupIndex) throws FileNotFoundException {
super(file, suffix);
@@ -124,7 +124,7 @@ public PeriodicSizeRotatingFileHandler(final File file, final String suffix, fin
* @param maxBackupIndex the maximum number of files to backup
* @param append {@code true} to append, {@code false} to overwrite
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public PeriodicSizeRotatingFileHandler(final File file, final String suffix, final long rotateSize, final int maxBackupIndex, final boolean append) throws FileNotFoundException {
super(file, suffix, append);
@@ -176,7 +176,7 @@ public boolean isRotateOnBoot() {
/**
* Set to a value of {@code true} if the file should be rotated before the a new file is set. The rotation only
- * happens if the file names are the same and the file has a {@link java.io.File#length() length} greater than 0.
+ * happens if the file names are the same and the file has a {@link File#length() length} greater than 0.
*
* @param rotateOnBoot {@code true} to rotate on boot, otherwise {@code false}
*/
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/QueueHandler.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/QueueHandler.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/handlers/QueueHandler.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/QueueHandler.java
index 4e1cc230..2a3cd9e9 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/QueueHandler.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/QueueHandler.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,19 +17,19 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.util.ArrayDeque;
import java.util.Deque;
-import org.jboss.logmanager.ExtHandler;
-import org.jboss.logmanager.ExtLogRecord;
-import org.wildfly.common.Assert;
-
import java.util.logging.ErrorManager;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
+import org.jboss.logmanager.ExtHandler;
+import org.jboss.logmanager.ExtLogRecord;
+import org.wildfly.common.Assert;
+
/**
* A queue handler which retains the last few messages logged. The handler can be used as-is to remember recent
* messages, or one or more handlers may be nested, which allows this handler to "replay" messages to the child
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SizeRotatingFileHandler.java
similarity index 92%
rename from core/src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/SizeRotatingFileHandler.java
index 0dbb0fa7..f0cd90e7 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SizeRotatingFileHandler.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,16 +17,16 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
-import java.io.IOException;
-import java.io.OutputStream;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.logging.ErrorManager;
import org.jboss.logmanager.ExtLogRecord;
-
-import java.util.logging.ErrorManager;
+import org.jboss.logmanager.handlers.FileHandler;
public class SizeRotatingFileHandler extends FileHandler {
// by default, rotate at 10MB
@@ -47,7 +47,7 @@ public SizeRotatingFileHandler() {
*
* @param file the file
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public SizeRotatingFileHandler(final File file) throws FileNotFoundException {
super(file);
@@ -59,7 +59,7 @@ public SizeRotatingFileHandler(final File file) throws FileNotFoundException {
* @param file the file
* @param append {@code true} to append, {@code false} to overwrite
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public SizeRotatingFileHandler(final File file, final boolean append) throws FileNotFoundException {
super(file, append);
@@ -70,7 +70,7 @@ public SizeRotatingFileHandler(final File file, final boolean append) throws Fil
*
* @param fileName the file name
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public SizeRotatingFileHandler(final String fileName) throws FileNotFoundException {
super(fileName);
@@ -82,7 +82,7 @@ public SizeRotatingFileHandler(final String fileName) throws FileNotFoundExcepti
* @param fileName the file name
* @param append {@code true} to append, {@code false} to overwrite
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public SizeRotatingFileHandler(final String fileName, final boolean append) throws FileNotFoundException {
super(fileName, append);
@@ -101,7 +101,7 @@ public SizeRotatingFileHandler(final long rotateSize, final int maxBackupIndex)
*
* @param file the file
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public SizeRotatingFileHandler(final File file, final long rotateSize, final int maxBackupIndex) throws FileNotFoundException {
super(file);
@@ -115,7 +115,7 @@ public SizeRotatingFileHandler(final File file, final long rotateSize, final int
* @param file the file
* @param append {@code true} to append, {@code false} to overwrite
*
- * @throws java.io.FileNotFoundException if the file could not be found on open
+ * @throws FileNotFoundException if the file could not be found on open
*/
public SizeRotatingFileHandler(final File file, final boolean append, final long rotateSize, final int maxBackupIndex) throws FileNotFoundException {
super(file, append);
@@ -161,7 +161,7 @@ public boolean isRotateOnBoot() {
/**
* Set to a value of {@code true} if the file should be rotated before the a new file is set. The rotation only
- * happens if the file names are the same and the file has a {@link java.io.File#length() length} greater than 0.
+ * happens if the file names are the same and the file has a {@link File#length() length} greater than 0.
*
* @param rotateOnBoot {@code true} to rotate on boot, otherwise {@code false}
*/
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/SocketHandler.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SocketHandler.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/handlers/SocketHandler.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/SocketHandler.java
index e4d4efc6..7f4a163a 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/SocketHandler.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SocketHandler.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2015 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.Closeable;
import java.io.Flushable;
@@ -35,6 +35,7 @@
import org.jboss.logmanager.ExtHandler;
import org.jboss.logmanager.ExtLogRecord;
+import org.jboss.logmanager.handlers.UninterruptibleOutputStream;
/**
* A handler used to communicate over a socket.
@@ -78,7 +79,7 @@ public enum Protocol {
private boolean initialize;
/**
- * Creates a socket handler with an address of {@linkplain java.net.InetAddress#getLocalHost() localhost} and port
+ * Creates a socket handler with an address of {@linkplain InetAddress#getLocalHost() localhost} and port
* of {@linkplain #DEFAULT_PORT 4560}.
*
* @throws UnknownHostException if an error occurs attempting to retrieve the localhost
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/SslTcpOutputStream.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SslTcpOutputStream.java
similarity index 83%
rename from core/src/main/java/org/jboss/logmanager/handlers/SslTcpOutputStream.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/SslTcpOutputStream.java
index 1bd34c3e..b4933c11 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/SslTcpOutputStream.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SslTcpOutputStream.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,8 +17,9 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
+import java.io.Flushable;
import java.io.IOException;
import java.net.InetAddress;
import javax.net.SocketFactory;
@@ -26,17 +27,17 @@
/**
* An output stream that writes data to a {@link java.net.Socket socket}. Uses {@link
- * javax.net.ssl.SSLSocketFactory#getDefault()} to create the socket.
+ * SSLSocketFactory#getDefault()} to create the socket.
*
* @author James R. Perkins
*/
@SuppressWarnings({"unused", "WeakerAccess"})
-public class SslTcpOutputStream extends TcpOutputStream implements FlushableCloseable {
+public class SslTcpOutputStream extends TcpOutputStream implements AutoCloseable, Flushable {
/**
* Creates a SSL TCP output stream.
*
- * Uses the {@link javax.net.ssl.SSLSocketFactory#getDefault() default socket factory} to create the socket.
+ * Uses the {@link SSLSocketFactory#getDefault() default socket factory} to create the socket.
*
* @param address the address to connect to
* @param port the port to connect to
@@ -50,7 +51,7 @@ public SslTcpOutputStream(final InetAddress address, final int port) throws IOEx
/**
* Creates a SSL TCP output stream.
*
- * Uses the {@link javax.net.ssl.SSLSocketFactory#getDefault() default socket factory} to create the socket.
+ * Uses the {@link SSLSocketFactory#getDefault() default socket factory} to create the socket.
*
* @param socketFactory the factory used to create the socket
* @param address the address to connect to
@@ -65,7 +66,7 @@ public SslTcpOutputStream(final SocketFactory socketFactory, final InetAddress a
/**
* Creates a SSL TCP output stream.
*
- * Uses the {@link javax.net.ssl.SSLSocketFactory#getDefault() default socket factory} to create the socket.
+ * Uses the {@link SSLSocketFactory#getDefault() default socket factory} to create the socket.
*
* @param address the address to connect to
* @param port the port to connect to
@@ -81,7 +82,7 @@ public SslTcpOutputStream(final InetAddress address, final int port, final boole
/**
* Creates a SSL TCP output stream.
*
- * Uses the {@link javax.net.ssl.SSLSocketFactory#getDefault() default socket factory} to create the socket.
+ * Uses the {@link SSLSocketFactory#getDefault() default socket factory} to create the socket.
*
* @param socketFactory the factory used to create the socket
* @param address the address to connect to
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/SuffixRotator.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SuffixRotator.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/handlers/SuffixRotator.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/SuffixRotator.java
index 8b45633c..e15ae441 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/SuffixRotator.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SuffixRotator.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.IOException;
import java.io.InputStream;
@@ -109,7 +109,7 @@ static SuffixRotator parse(final String suffix) {
}
/**
- * The {@linkplain java.text.SimpleDateFormat date format pattern} for the suffix or an empty
+ * The {@linkplain SimpleDateFormat date format pattern} for the suffix or an empty
* {@linkplain String string}.
*
* @return the date pattern or an empty string
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/SyslogHandler.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SyslogHandler.java
similarity index 98%
rename from core/src/main/java/org/jboss/logmanager/handlers/SyslogHandler.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/SyslogHandler.java
index e5f568fc..3a1f2281 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/SyslogHandler.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/SyslogHandler.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.Closeable;
import java.io.Flushable;
@@ -47,7 +47,7 @@
*
* This handler can write to syslog servers that accept the RFC3164
* and RFC5424 formats. Writes can be done via TCP, SSL over TCP or
- * UDP protocols. You can also override the {@link #setOutputStream(java.io.OutputStream) output stream} if a custom
+ * UDP protocols. You can also override the {@link #setOutputStream(OutputStream) output stream} if a custom
* protocol is needed.
*
*
@@ -67,7 +67,7 @@
*
* serverHostname |
* The address of the syslog server |
- * {@link java.lang.String String} |
+ * {@link String String} |
* localhost |
*
*
@@ -85,14 +85,14 @@
*
* appName |
* The name of the application that is logging |
- * {@link java.lang.String String} |
+ * {@link String String} |
* java |
*
*
* hostname |
* The name of the host the messages are being sent from. See {@link #setHostname(String)} for more
* details |
- * {@link java.lang.String String} |
+ * {@link String String} |
* {@code null} |
*
*
@@ -111,7 +111,7 @@
* delimiter |
* The delimiter to use at the end of the message if {@link #setUseMessageDelimiter(boolean) useDelimiter}
* is set to {@code true} |
- * {@link java.lang.String String} |
+ * {@link String String} |
* For {@link Protocol#UDP UDP} {@code null} - For {@link Protocol#TCP TCP} or {@link Protocol#SSL_TCP
* SSL_TCP} {@code \n} |
*
@@ -634,8 +634,8 @@ public void setAppName(final String appName) {
}
/**
- * Indicates whether or not a {@link org.jboss.logmanager.handlers.SyslogHandler.Protocol#TCP TCP} or {@link
- * org.jboss.logmanager.handlers.SyslogHandler.Protocol#SSL_TCP SSL TCP} connection should block when attempting to
+ * Indicates whether or not a {@link SyslogHandler.Protocol#TCP TCP} or {@link
+ * SyslogHandler.Protocol#SSL_TCP SSL TCP} connection should block when attempting to
* reconnect.
*
* @return {@code true} if blocking is enabled, otherwise {@code false}
@@ -647,8 +647,8 @@ public boolean isBlockOnReconnect() {
}
/**
- * Enables or disables blocking when attempting to reconnect a {@link org.jboss.logmanager.handlers.SyslogHandler.Protocol#TCP
- * TCP} or {@link org.jboss.logmanager.handlers.SyslogHandler.Protocol#SSL_TCP SSL TCP} protocol.
+ * Enables or disables blocking when attempting to reconnect a {@link SyslogHandler.Protocol#TCP
+ * TCP} or {@link SyslogHandler.Protocol#SSL_TCP SSL TCP} protocol.
*
* If set to {@code true} the {@code publish} methods will block when attempting to reconnect. This is only
* advisable to be set to {@code true} if using an asynchronous handler.
@@ -1013,8 +1013,8 @@ public void setProtocol(final Protocol type) {
*
* Setting the output stream closes any already established connections or open output streams and will not open
* any new connections until the output stream is set to {@code null}. The {@link
- * #setProtocol(org.jboss.logmanager.handlers.SyslogHandler.Protocol) protocol}, {@link
- * #setServerAddress(java.net.InetAddress), server address}, {@link #setServerHostname(String) server hostname} or
+ * #setProtocol(SyslogHandler.Protocol) protocol}, {@link
+ * #setServerAddress(InetAddress), server address}, {@link #setServerHostname(String) server hostname} or
* {@link #setPort(int) port} have no effect when the output stream is set.
*
* @param out the output stream to write to
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/TcpOutputStream.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/TcpOutputStream.java
similarity index 93%
rename from core/src/main/java/org/jboss/logmanager/handlers/TcpOutputStream.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/TcpOutputStream.java
index fb2b6dae..15a6336f 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/TcpOutputStream.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/TcpOutputStream.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,9 +17,10 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.Closeable;
+import java.io.Flushable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
@@ -35,10 +36,10 @@
import javax.net.SocketFactory;
/**
- * An output stream that writes data to a {@link java.net.Socket socket}.
+ * An output stream that writes data to a {@link Socket socket}.
*
- * If an {@link java.io.IOException IOException} occurs during a {@link #write(byte[], int, int)} and a {@link
- * javax.net.SocketFactory socket factory} was defined the stream will attempt to reconnect indefinitely. By default
+ * If an {@link IOException IOException} occurs during a {@link #write(byte[], int, int)} and a {@link
+ * SocketFactory socket factory} was defined the stream will attempt to reconnect indefinitely. By default
* additional writes are discarded when reconnecting. If you set the {@link #setBlockOnReconnect(boolean) block on
* reconnect} to {@code true}, then the reconnect will indefinitely block until the TCP stream is reconnected.
*
@@ -47,7 +48,7 @@
* @author James R. Perkins
*/
@SuppressWarnings({"unused", "WeakerAccess"})
-public class TcpOutputStream extends OutputStream implements FlushableCloseable {
+public class TcpOutputStream extends OutputStream implements AutoCloseable, Flushable {
private static final long retryTimeout = 5L;
private static final long maxRetryTimeout = 40L;
private static final int maxErrors = 10;
@@ -69,7 +70,7 @@ public class TcpOutputStream extends OutputStream implements FlushableCloseable
/**
* Creates a TCP output stream.
*
- * Uses the {@link javax.net.SocketFactory#getDefault() default socket factory} to create the socket.
+ * Uses the {@link SocketFactory#getDefault() default socket factory} to create the socket.
*
* @param address the address to connect to
* @param port the port to connect to
@@ -84,7 +85,7 @@ public TcpOutputStream(final InetAddress address, final int port) throws IOExcep
/**
* Creates a TCP output stream.
*
- * Uses the {@link javax.net.SocketFactory#getDefault() default socket factory} to create the socket.
+ * Uses the {@link SocketFactory#getDefault() default socket factory} to create the socket.
*
*
* @param address the address to connect to
@@ -119,7 +120,7 @@ protected TcpOutputStream(final Socket socket) {
/**
* Creates a new TCP output stream.
*
- * Creates a {@link java.net.Socket socket} from the {@code socketFactory} argument.
+ * Creates a {@link Socket socket} from the {@code socketFactory} argument.
*
* @param socketFactory the factory used to create the socket
* @param address the address to connect to
@@ -135,7 +136,7 @@ protected TcpOutputStream(final SocketFactory socketFactory, final InetAddress a
/**
* Creates a new TCP output stream.
*
- * Creates a {@link java.net.Socket socket} from the {@code socketFactory} argument.
+ * Creates a {@link Socket socket} from the {@code socketFactory} argument.
*
*
* @param socketFactory the factory used to create the socket
@@ -272,7 +273,7 @@ public void setBlockOnReconnect(final boolean blockOnReconnect) {
/**
* Returns the connected state of the TCP stream.
*
- * The stream is said to be disconnected when an {@link java.io.IOException} occurs during a write. Otherwise a
+ * The stream is said to be disconnected when an {@link IOException} occurs during a write. Otherwise a
* stream is considered connected.
*
* @return {@code true} if the stream is connected, otherwise {@code false}
diff --git a/core/src/main/java/org/jboss/logmanager/handlers/UdpOutputStream.java b/ext/src/main/java/org/jboss/logmanager/ext/handlers/UdpOutputStream.java
similarity index 88%
rename from core/src/main/java/org/jboss/logmanager/handlers/UdpOutputStream.java
rename to ext/src/main/java/org/jboss/logmanager/ext/handlers/UdpOutputStream.java
index 07419e42..757edde6 100644
--- a/core/src/main/java/org/jboss/logmanager/handlers/UdpOutputStream.java
+++ b/ext/src/main/java/org/jboss/logmanager/ext/handlers/UdpOutputStream.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,8 +17,9 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
+import java.io.Flushable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.DatagramPacket;
@@ -28,12 +29,12 @@
import java.net.SocketException;
/**
- * An output stream that writes data to a {@link java.net.DatagramSocket DatagramSocket}.
+ * An output stream that writes data to a {@link DatagramSocket DatagramSocket}.
*
* @author James R. Perkins
*/
@SuppressWarnings("WeakerAccess")
-public class UdpOutputStream extends OutputStream implements FlushableCloseable {
+public class UdpOutputStream extends OutputStream implements AutoCloseable, Flushable {
private final DatagramSocket socket;
private final SocketAddress socketAddress;
diff --git a/core/src/main/resources/xml-formatter.xsd b/ext/src/main/resources/xml-formatter.xsd
similarity index 100%
rename from core/src/main/resources/xml-formatter.xsd
rename to ext/src/main/resources/xml-formatter.xsd
diff --git a/core/src/test/java/org/jboss/logmanager/MapTestUtils.java b/ext/src/test/java/org/jboss/logmanager/ext/MapTestUtils.java
similarity index 96%
rename from core/src/test/java/org/jboss/logmanager/MapTestUtils.java
rename to ext/src/test/java/org/jboss/logmanager/ext/MapTestUtils.java
index 8884e22e..a56c1eaf 100644
--- a/core/src/test/java/org/jboss/logmanager/MapTestUtils.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/MapTestUtils.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager;
+package org.jboss.logmanager.ext;
import java.util.Collections;
import java.util.LinkedHashMap;
diff --git a/core/src/test/java/org/jboss/logmanager/PropertyValuesTests.java b/ext/src/test/java/org/jboss/logmanager/ext/PropertyValuesTests.java
similarity index 97%
rename from core/src/test/java/org/jboss/logmanager/PropertyValuesTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/PropertyValuesTests.java
index 1a102b0a..6f80295b 100644
--- a/core/src/test/java/org/jboss/logmanager/PropertyValuesTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/PropertyValuesTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,12 +17,12 @@
* limitations under the License.
*/
-package org.jboss.logmanager;
+package org.jboss.logmanager.ext;
import java.util.EnumMap;
import java.util.Map;
-import org.jboss.logmanager.formatters.StructuredFormatter.Key;
+import org.jboss.logmanager.ext.formatters.StructuredFormatter.Key;
import org.junit.Assert;
import org.junit.Test;
diff --git a/core/src/test/java/org/jboss/logmanager/formatters/AbstractTest.java b/ext/src/test/java/org/jboss/logmanager/ext/formatters/AbstractTest.java
similarity index 91%
rename from core/src/test/java/org/jboss/logmanager/formatters/AbstractTest.java
rename to ext/src/test/java/org/jboss/logmanager/ext/formatters/AbstractTest.java
index 6bff603f..b1d928d9 100644
--- a/core/src/test/java/org/jboss/logmanager/formatters/AbstractTest.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/formatters/AbstractTest.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,11 +17,11 @@
* limitations under the License.
*/
-package org.jboss.logmanager.formatters;
+package org.jboss.logmanager.ext.formatters;
import org.jboss.logmanager.ExtLogRecord;
import org.jboss.logmanager.ExtLogRecord.FormatStyle;
-import org.jboss.logmanager.MapTestUtils;
+import org.jboss.logmanager.ext.MapTestUtils;
/**
* @author James R. Perkins
diff --git a/core/src/test/java/org/jboss/logmanager/formatters/JsonFormatterTests.java b/ext/src/test/java/org/jboss/logmanager/ext/formatters/JsonFormatterTests.java
similarity index 98%
rename from core/src/test/java/org/jboss/logmanager/formatters/JsonFormatterTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/formatters/JsonFormatterTests.java
index d4c2825a..c7b40d67 100644
--- a/core/src/test/java/org/jboss/logmanager/formatters/JsonFormatterTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/formatters/JsonFormatterTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.formatters;
+package org.jboss.logmanager.ext.formatters;
import java.io.StringReader;
import java.time.Instant;
@@ -36,7 +36,7 @@
import org.jboss.logmanager.ExtFormatter;
import org.jboss.logmanager.ExtLogRecord;
import org.jboss.logmanager.Level;
-import org.jboss.logmanager.formatters.StructuredFormatter.Key;
+import org.jboss.logmanager.ext.formatters.StructuredFormatter.Key;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
diff --git a/core/src/test/java/org/jboss/logmanager/formatters/XmlFormatterTests.java b/ext/src/test/java/org/jboss/logmanager/ext/formatters/XmlFormatterTests.java
similarity index 98%
rename from core/src/test/java/org/jboss/logmanager/formatters/XmlFormatterTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/formatters/XmlFormatterTests.java
index c5236dc1..c3d13ce1 100644
--- a/core/src/test/java/org/jboss/logmanager/formatters/XmlFormatterTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/formatters/XmlFormatterTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2017 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.formatters;
+package org.jboss.logmanager.ext.formatters;
import java.io.StringReader;
import java.time.Instant;
@@ -39,7 +39,7 @@
import org.jboss.logmanager.ExtFormatter;
import org.jboss.logmanager.ExtLogRecord;
import org.jboss.logmanager.Level;
-import org.jboss.logmanager.formatters.StructuredFormatter.Key;
+import org.jboss.logmanager.ext.formatters.StructuredFormatter.Key;
import org.junit.Assert;
import org.junit.Test;
import org.xml.sax.ErrorHandler;
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/AbstractHandlerTest.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/AbstractHandlerTest.java
similarity index 97%
rename from core/src/test/java/org/jboss/logmanager/handlers/AbstractHandlerTest.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/AbstractHandlerTest.java
index 7e8a5222..a17a4fed 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/AbstractHandlerTest.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/AbstractHandlerTest.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.BufferedReader;
import java.io.File;
@@ -47,7 +47,7 @@ public class AbstractHandlerTest {
static final File BASE_LOG_DIR;
static {
- BASE_LOG_DIR = new File(System.getProperty("test.log.dir"));
+ BASE_LOG_DIR = new File(System.getProperty("log.dir"));
}
final static PatternFormatter FORMATTER = new PatternFormatter("%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n");
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/AsyncHandlerTests.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/AsyncHandlerTests.java
similarity index 95%
rename from core/src/test/java/org/jboss/logmanager/handlers/AsyncHandlerTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/AsyncHandlerTests.java
index 30d05611..1eab456a 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/AsyncHandlerTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/AsyncHandlerTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;
@@ -29,7 +29,7 @@
import org.jboss.logmanager.MDC;
import org.jboss.logmanager.NDC;
import org.jboss.logmanager.formatters.PatternFormatter;
-import org.jboss.logmanager.handlers.AsyncHandler.OverflowAction;
+import org.jboss.logmanager.ext.handlers.AsyncHandler.OverflowAction;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandlerTests.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/PeriodicRotatingFileHandlerTests.java
similarity index 98%
rename from core/src/test/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandlerTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/PeriodicRotatingFileHandlerTests.java
index 3010d41b..dd6f8268 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandlerTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/PeriodicRotatingFileHandlerTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2015 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/PeriodicSizeRotatingFileHandlerTests.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/PeriodicSizeRotatingFileHandlerTests.java
similarity index 99%
rename from core/src/test/java/org/jboss/logmanager/handlers/PeriodicSizeRotatingFileHandlerTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/PeriodicSizeRotatingFileHandlerTests.java
index 2c4159d2..4acceb61 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/PeriodicSizeRotatingFileHandlerTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/PeriodicSizeRotatingFileHandlerTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.File;
import java.nio.charset.StandardCharsets;
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/QueueHandlerTests.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/QueueHandlerTests.java
similarity index 97%
rename from core/src/test/java/org/jboss/logmanager/handlers/QueueHandlerTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/QueueHandlerTests.java
index 637eb555..495524d4 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/QueueHandlerTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/QueueHandlerTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/SimpleServer.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SimpleServer.java
similarity index 89%
rename from core/src/test/java/org/jboss/logmanager/handlers/SimpleServer.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/SimpleServer.java
index 66989068..7c377ace 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/SimpleServer.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SimpleServer.java
@@ -1,4 +1,23 @@
-package org.jboss.logmanager.handlers;
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * Copyright 2018 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed 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.jboss.logmanager.ext.handlers;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/SizeRotatingFileHandlerTests.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SizeRotatingFileHandlerTests.java
similarity index 98%
rename from core/src/test/java/org/jboss/logmanager/handlers/SizeRotatingFileHandlerTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/SizeRotatingFileHandlerTests.java
index 7358e51e..7d046df2 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/SizeRotatingFileHandlerTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SizeRotatingFileHandlerTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.File;
import java.nio.charset.StandardCharsets;
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/SocketHandlerTests.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SocketHandlerTests.java
similarity index 87%
rename from core/src/test/java/org/jboss/logmanager/handlers/SocketHandlerTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/SocketHandlerTests.java
index 6322b1f5..827ed55f 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/SocketHandlerTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SocketHandlerTests.java
@@ -1,19 +1,36 @@
-package org.jboss.logmanager.handlers;
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * Copyright 2018 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed 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.jboss.logmanager.ext.handlers;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
-import java.util.logging.Handler;
-
import javax.net.ssl.SSLContext;
import org.jboss.logmanager.ExtLogRecord;
import org.jboss.logmanager.LogContext;
import org.jboss.logmanager.Logger;
import org.jboss.logmanager.formatters.PatternFormatter;
-import org.jboss.logmanager.handlers.SocketHandler.Protocol;
+import org.jboss.logmanager.ext.handlers.SocketHandler.Protocol;
import org.junit.Assert;
import org.junit.Test;
@@ -39,7 +56,7 @@ public void testTcpConnection() throws Exception {
SocketHandler handler = createHandler(Protocol.TCP)
) {
final ExtLogRecord record = createLogRecord("Test TCP handler");
- handler.doPublish(record);
+ handler.publish(record);
final String msg = server.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test TCP handler", msg);
@@ -53,7 +70,7 @@ public void testTlsConnection() throws Exception {
SocketHandler handler = createHandler(Protocol.SSL_TCP)
) {
final ExtLogRecord record = createLogRecord("Test TLS handler");
- handler.doPublish(record);
+ handler.publish(record);
final String msg = server.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test TLS handler", msg);
@@ -67,7 +84,7 @@ public void testUdpConnection() throws Exception {
SocketHandler handler = createHandler(Protocol.UDP)
) {
final ExtLogRecord record = createLogRecord("Test UDP handler");
- handler.doPublish(record);
+ handler.publish(record);
final String msg = server.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test UDP handler", msg);
@@ -82,7 +99,7 @@ public void testTcpPortChange() throws Exception {
SocketHandler handler = createHandler(Protocol.TCP)
) {
ExtLogRecord record = createLogRecord("Test TCP handler " + port);
- handler.doPublish(record);
+ handler.publish(record);
String msg = server1.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test TCP handler " + port, msg);
@@ -90,7 +107,7 @@ public void testTcpPortChange() throws Exception {
// Change the port on the handler which should close the first connection and open a new one
handler.setPort(altPort);
record = createLogRecord("Test TCP handler " + altPort);
- handler.doPublish(record);
+ handler.publish(record);
msg = server2.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test TCP handler " + altPort, msg);
@@ -106,7 +123,7 @@ public void testProtocolChange() throws Exception {
try (SocketHandler handler = createHandler(Protocol.TCP)) {
try (SimpleServer server = SimpleServer.createTcpServer(port)) {
final ExtLogRecord record = createLogRecord("Test TCP handler");
- handler.doPublish(record);
+ handler.publish(record);
final String msg = server.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test TCP handler", msg);
@@ -117,7 +134,7 @@ public void testProtocolChange() throws Exception {
try (SimpleServer server = SimpleServer.createTlsServer(port)) {
final ExtLogRecord record = createLogRecord("Test TLS handler");
- handler.doPublish(record);
+ handler.publish(record);
final String msg = server.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test TLS handler", msg);
@@ -134,7 +151,7 @@ public void testTcpReconnect() throws Exception {
SimpleServer server = SimpleServer.createTcpServer(port)
) {
final ExtLogRecord record = createLogRecord("Test TCP handler");
- handler.doPublish(record);
+ handler.publish(record);
final String msg = server.timeoutPoll();
Assert.assertNotNull(msg);
Assert.assertEquals("Test TCP handler", msg);
@@ -143,14 +160,14 @@ public void testTcpReconnect() throws Exception {
// Publish a record to a down server, this likely won't put the handler in an error state yet. However once
// we restart the server and loop the first socket should fail before a reconnect is attempted.
final ExtLogRecord record = createLogRecord("Test TCP handler");
- handler.doPublish(record);
+ handler.publish(record);
try (
SimpleServer server = SimpleServer.createTcpServer(port)
) {
// Keep writing a record until a successful record is published or a timeout occurs
final String msg = timeout(() -> {
final ExtLogRecord r = createLogRecord("Test TCP handler");
- handler.doPublish(r);
+ handler.publish(r);
try {
return server.poll();
} catch (InterruptedException e) {
diff --git a/core/src/test/java/org/jboss/logmanager/handlers/SyslogHandlerTests.java b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SyslogHandlerTests.java
similarity index 98%
rename from core/src/test/java/org/jboss/logmanager/handlers/SyslogHandlerTests.java
rename to ext/src/test/java/org/jboss/logmanager/ext/handlers/SyslogHandlerTests.java
index 57026b87..067dfe3c 100644
--- a/core/src/test/java/org/jboss/logmanager/handlers/SyslogHandlerTests.java
+++ b/ext/src/test/java/org/jboss/logmanager/ext/handlers/SyslogHandlerTests.java
@@ -1,7 +1,7 @@
/*
* JBoss, Home of Professional Open Source.
*
- * Copyright 2014 Red Hat, Inc., and individual contributors
+ * Copyright 2018 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-package org.jboss.logmanager.handlers;
+package org.jboss.logmanager.ext.handlers;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
@@ -27,7 +27,7 @@
import org.jboss.logmanager.ExtLogRecord;
import org.jboss.logmanager.formatters.PatternFormatter;
-import org.jboss.logmanager.handlers.SyslogHandler.SyslogType;
+import org.jboss.logmanager.ext.handlers.SyslogHandler.SyslogType;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
diff --git a/core/src/test/resources/client-keystore.jks b/ext/src/test/resources/client-keystore.jks
similarity index 100%
rename from core/src/test/resources/client-keystore.jks
rename to ext/src/test/resources/client-keystore.jks
diff --git a/core/src/test/resources/client.cer b/ext/src/test/resources/client.cer
similarity index 100%
rename from core/src/test/resources/client.cer
rename to ext/src/test/resources/client.cer
diff --git a/core/src/test/resources/generate.sh b/ext/src/test/resources/generate.sh
similarity index 100%
rename from core/src/test/resources/generate.sh
rename to ext/src/test/resources/generate.sh
diff --git a/core/src/test/resources/server-keystore.jks b/ext/src/test/resources/server-keystore.jks
similarity index 100%
rename from core/src/test/resources/server-keystore.jks
rename to ext/src/test/resources/server-keystore.jks
diff --git a/core/src/test/resources/server.cer b/ext/src/test/resources/server.cer
similarity index 100%
rename from core/src/test/resources/server.cer
rename to ext/src/test/resources/server.cer
diff --git a/core/src/test/resources/test-client-store.jks b/ext/src/test/resources/test-client-store.jks
similarity index 100%
rename from core/src/test/resources/test-client-store.jks
rename to ext/src/test/resources/test-client-store.jks
diff --git a/core/src/test/resources/test-server-store.jks b/ext/src/test/resources/test-server-store.jks
similarity index 100%
rename from core/src/test/resources/test-server-store.jks
rename to ext/src/test/resources/test-server-store.jks