You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/03/26 06:08:50 UTC

[1/6] logging-log4j2 git commit: LOG4J2-1330 - Fix NoClassDefFoundError in ReflectionUtil on Google App Engine

Repository: logging-log4j2
Updated Branches:
  refs/heads/LOG4J2-1278-gc-free-logger c6cc1c0be -> fa719343a


LOG4J2-1330 - Fix NoClassDefFoundError in ReflectionUtil on Google App Engine


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 416092873f7d5a58f755f80e7061f83da93657e8
Parents: d90306f
Author: Matt Sicker <bo...@gmail.com>
Authored: Fri Mar 25 09:11:05 2016 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Fri Mar 25 09:11:05 2016 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/logging/log4j/util/ReflectionUtil.java   | 2 +-
 src/changes/changes.xml                                           | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/41609287/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
index dec2350..7da8c2c 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
@@ -80,7 +80,7 @@ public final class ReflectionUtil {
                     java7u25CompensationOffset = 1;
                 }
             }
-        } catch (final Exception e) {
+        } catch (final Throwable e) {
             LOGGER.info("sun.reflect.Reflection.getCallerClass is not supported. "
                     + "ReflectionUtil.getCallerClass will be much slower due to this.", e);
             getCallerClass = null;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/41609287/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cdfabf9..fafc907 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -223,6 +223,9 @@
       <action issue="LOG4J2-1322" dev="mattsicker" type="update">
         Update Log4j 1.x migration guide to include information about system property lookup syntax changes.
       </action>
+      <action issue="LOG4J2-1330" dev="mattsicker" type="fix">
+        Fix NoClassDefFoundError in ReflectionUtil on Google App Engine.
+      </action>
     </release>
     <release version="2.5" date="2015-12-06" description="GA Release 2.5">
       <action issue="LOG4J2-324" dev="rpopma" type="fix">


[5/6] logging-log4j2 git commit: LOG4J2-1324 Change log update for the new Async Logger exception handlers.

Posted by rp...@apache.org.
LOG4J2-1324 Change log update for the new Async Logger exception handlers.


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: ea43a55c8bde389991ca8d2a2301ae29e91ecb83
Parents: f788207
Author: rpopma <rp...@apache.org>
Authored: Sat Mar 26 14:03:05 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Mar 26 14:03:05 2016 +0900

----------------------------------------------------------------------
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ea43a55c/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fafc907..3f23129 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.6" date="2016-MM-DD" description="GA Release 2.6">
+      <action issue="LOG4J2-1324" dev="rpopma" type="fix">
+        Improve error handling in the Async Logger background thread: the new default exception handler no longer rethrows the error.
+      </action>
       <action issue="LOG4J2-1321" dev="rpopma" type="update">
         Avoid allocating unnecessary temporary objects in PatternLayout's NamePatternConverter and ClassNamePatternConverter.
       </action>


[6/6] logging-log4j2 git commit: Merge remote-tracking branch 'remotes/origin/master' into LOG4J2-1278-gc-free-logger

Posted by rp...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into LOG4J2-1278-gc-free-logger


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: fa719343a95f21587944918d382ddd2d0209dcb9
Parents: c6cc1c0 ea43a55
Author: rpopma <rp...@apache.org>
Authored: Sat Mar 26 14:08:40 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Mar 26 14:08:40 2016 +0900

----------------------------------------------------------------------
 .../logging/log4j/util/ReflectionUtil.java      |  2 +-
 .../core/async/AsyncLoggerConfigDisruptor.java  | 10 ++--
 .../log4j/core/async/AsyncLoggerDisruptor.java  |  3 +-
 ...efaultAsyncLoggerConfigExceptionHandler.java | 54 ++++++++++++++++++++
 .../DefaultAsyncLoggerExceptionHandler.java     | 52 +++++++++++++++++++
 .../logging/log4j/core/async/DisruptorUtil.java | 30 ++++++++---
 src/changes/changes.xml                         |  6 +++
 src/site/xdoc/manual/async.xml                  | 12 ++++-
 src/site/xdoc/manual/configuration.xml.vm       |  5 +-
 9 files changed, 156 insertions(+), 18 deletions(-)
----------------------------------------------------------------------



[4/6] logging-log4j2 git commit: LOG4J2-1324 Documentation updates for the new exception handlers.

Posted by rp...@apache.org.
LOG4J2-1324 Documentation updates for the new exception handlers.


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: f788207a3dba0d5bb1885a1ae155a590333daf1f
Parents: 4bb7d6d
Author: rpopma <rp...@apache.org>
Authored: Sat Mar 26 14:02:34 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Mar 26 14:02:34 2016 +0900

----------------------------------------------------------------------
 src/site/xdoc/manual/async.xml            | 12 ++++++++++--
 src/site/xdoc/manual/configuration.xml.vm |  5 ++---
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f788207a/src/site/xdoc/manual/async.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/async.xml b/src/site/xdoc/manual/async.xml
index 36c7ebe..c95a805 100644
--- a/src/site/xdoc/manual/async.xml
+++ b/src/site/xdoc/manual/async.xml
@@ -186,12 +186,16 @@
           <tr>
             <td>AsyncLogger.ExceptionHandler</td>
             <td>
-              <tt>null</tt>
+              <tt>default handler</tt>
             </td>
             <td>
               Fully qualified name of a class that implements the <tt>com.lmax.disruptor.ExceptionHandler</tt>
               interface. The class needs to have a public zero-argument constructor.
               If specified, this class will be notified when an exception occurs while logging the messages.
+              <p>
+                If not specified, the default exception handler will print a message and stack trace to the standard
+                error output stream.
+              </p>
             </td>
           </tr>
           <tr>
@@ -347,12 +351,16 @@
           <tr>
             <td>AsyncLoggerConfig.ExceptionHandler</td>
             <td>
-              <tt>null</tt>
+              <tt>default handler</tt>
             </td>
             <td>
               Fully qualified name of a class that implements the <tt>com.lmax.disruptor.ExceptionHandler</tt>
               interface. The class needs to have a public zero-argument constructor.
               If specified, this class will be notified when an exception occurs while logging the messages.
+              <p>
+                If not specified, the default exception handler will print a message and stack trace to the standard
+                error output stream.
+              </p>
             </td>
           </tr>
           <tr>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f788207a/src/site/xdoc/manual/configuration.xml.vm
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/configuration.xml.vm b/src/site/xdoc/manual/configuration.xml.vm
index 18d53b2..773d5d3 100644
--- a/src/site/xdoc/manual/configuration.xml.vm
+++ b/src/site/xdoc/manual/configuration.xml.vm
@@ -1798,8 +1798,7 @@ public class AwesomeTest {
   </tr>
   <tr>
     <td>AsyncLogger.ExceptionHandler</td>
-    <td>&nbsp;
-    </td>
+    <td>default handler</td>
     <td>
       See <a href="async.html#SysPropsAllAsync">Async Logger System Properties</a> for details.
     </td>
@@ -1831,7 +1830,7 @@ public class AwesomeTest {
   </tr>
   <tr>
     <td>AsyncLoggerConfig.ExceptionHandler</td>
-    <td>&nbsp;    </td>
+    <td>default handler</td>
     <td>
       See <a href="async.html#SysPropsMixedSync-Async">Mixed Async/Synchronous Logger System Properties</a> for details.
     </td>


[3/6] logging-log4j2 git commit: LOG4J2-1324 Update Disruptor setup logic to use the new exception handlers.

Posted by rp...@apache.org.
LOG4J2-1324 Update Disruptor setup logic to use the  new exception handlers.


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 4bb7d6d03e66c80c76f0d328fefbc7f7195d7f4e
Parents: cf2de96
Author: rpopma <rp...@apache.org>
Authored: Sat Mar 26 14:01:39 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Mar 26 14:01:39 2016 +0900

----------------------------------------------------------------------
 .../core/async/AsyncLoggerConfigDisruptor.java  | 10 +++++--
 .../log4j/core/async/AsyncLoggerDisruptor.java  |  3 +-
 .../logging/log4j/core/async/DisruptorUtil.java | 30 +++++++++++++++-----
 3 files changed, 31 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4bb7d6d0/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
index 20abda8..8f5cec7 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java
@@ -63,7 +63,7 @@ public class AsyncLoggerConfigDisruptor implements AsyncLoggerConfigDelegate {
     /**
      * RingBuffer events contain all information necessary to perform the work in a separate thread.
      */
-    private static class Log4jEventWrapper {
+    public static class Log4jEventWrapper {
         private AsyncLoggerConfig loggerConfig;
         private LogEvent event;
 
@@ -74,6 +74,11 @@ public class AsyncLoggerConfigDisruptor implements AsyncLoggerConfigDelegate {
             loggerConfig = null;
             event = null;
         }
+
+        @Override
+        public String toString() {
+            return String.valueOf(event);
+        }
     }
 
     /**
@@ -166,8 +171,7 @@ public class AsyncLoggerConfigDisruptor implements AsyncLoggerConfigDelegate {
 
         disruptor = new Disruptor<>(FACTORY, ringBufferSize, executor, ProducerType.MULTI, waitStrategy);
 
-        final ExceptionHandler<Log4jEventWrapper> errorHandler = DisruptorUtil.getExceptionHandler(
-                "AsyncLoggerConfig.ExceptionHandler", Log4jEventWrapper.class);
+        final ExceptionHandler<Log4jEventWrapper> errorHandler = DisruptorUtil.getAsyncLoggerConfigExceptionHandler();
         disruptor.handleExceptionsWith(errorHandler);
 
         final Log4jEventWrapperHandler[] handlers = {new Log4jEventWrapperHandler()};

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4bb7d6d0/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
index 1e1cd1e..1bc7710 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
@@ -88,8 +88,7 @@ class AsyncLoggerDisruptor {
         disruptor = new Disruptor<>(RingBufferLogEvent.FACTORY, ringBufferSize, executor, ProducerType.MULTI,
                 waitStrategy);
 
-        final ExceptionHandler<RingBufferLogEvent> errorHandler = DisruptorUtil.getExceptionHandler(
-                "AsyncLogger.ExceptionHandler", RingBufferLogEvent.class);
+        final ExceptionHandler<RingBufferLogEvent> errorHandler = DisruptorUtil.getAsyncLoggerExceptionHandler();
         disruptor.handleExceptionsWith(errorHandler);
 
         final RingBufferLogEventHandler[] handlers = {new RingBufferLogEventHandler()};

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4bb7d6d0/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
index 8d368fe..c4083a4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
@@ -89,19 +89,35 @@ final class DisruptorUtil {
         return Integers.ceilingNextPowerOfTwo(ringBufferSize);
     }
 
-    static <T> ExceptionHandler<T> getExceptionHandler(final String propertyName, Class<T> type) {
-        final String cls = PropertiesUtil.getProperties().getStringProperty(propertyName);
+    static ExceptionHandler<RingBufferLogEvent> getAsyncLoggerExceptionHandler() {
+        final String cls = PropertiesUtil.getProperties().getStringProperty("AsyncLogger.ExceptionHandler");
         if (cls == null) {
-            return null;
+            return new DefaultAsyncLoggerExceptionHandler();
         }
         try {
             @SuppressWarnings("unchecked")
-            final Class<? extends ExceptionHandler<T>> klass =
-                (Class<? extends ExceptionHandler<T>>) LoaderUtil.loadClass(cls);
+            final Class<? extends ExceptionHandler<RingBufferLogEvent>> klass =
+                (Class<? extends ExceptionHandler<RingBufferLogEvent>>) LoaderUtil.loadClass(cls);
             return klass.newInstance();
         } catch (final Exception ignored) {
-            LOGGER.debug("Invalid {} value: error creating {}: ", propertyName, cls, ignored);
-            return null;
+            LOGGER.debug("Invalid AsyncLogger.ExceptionHandler value: error creating {}: ", cls, ignored);
+            return new DefaultAsyncLoggerExceptionHandler();
+        }
+    }
+
+    static ExceptionHandler<AsyncLoggerConfigDisruptor.Log4jEventWrapper> getAsyncLoggerConfigExceptionHandler() {
+        final String cls = PropertiesUtil.getProperties().getStringProperty("AsyncLoggerConfig.ExceptionHandler");
+        if (cls == null) {
+            return new DefaultAsyncLoggerConfigExceptionHandler();
+        }
+        try {
+            @SuppressWarnings("unchecked")
+            final Class<? extends ExceptionHandler<AsyncLoggerConfigDisruptor.Log4jEventWrapper>> klass =
+                    (Class<? extends ExceptionHandler<AsyncLoggerConfigDisruptor.Log4jEventWrapper>>) LoaderUtil.loadClass(cls);
+            return klass.newInstance();
+        } catch (final Exception ignored) {
+            LOGGER.debug("Invalid AsyncLoggerConfig.ExceptionHandler value: error creating {}: ", cls, ignored);
+            return new DefaultAsyncLoggerConfigExceptionHandler();
         }
     }
 


[2/6] logging-log4j2 git commit: LOG4J2-1324 Added new default async logger and async logger config exception handlers that log to the standard error stream and do not rethrow the exception.

Posted by rp...@apache.org.
LOG4J2-1324 Added new default async logger and async logger config exception handlers that log to the standard error stream and do not rethrow the exception.


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: cf2de969cdc1ddfc17b12a5655ebc715cf89a961
Parents: 4160928
Author: rpopma <rp...@apache.org>
Authored: Sat Mar 26 14:00:35 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Mar 26 14:00:35 2016 +0900

----------------------------------------------------------------------
 ...efaultAsyncLoggerConfigExceptionHandler.java | 54 ++++++++++++++++++++
 .../DefaultAsyncLoggerExceptionHandler.java     | 52 +++++++++++++++++++
 2 files changed, 106 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cf2de969/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerConfigExceptionHandler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerConfigExceptionHandler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerConfigExceptionHandler.java
new file mode 100644
index 0000000..2b1612a
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerConfigExceptionHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.async;
+
+import com.lmax.disruptor.ExceptionHandler;
+
+/**
+ * Default disruptor exception handler for errors that occur in the AsyncLogger background thread.
+ */
+public class DefaultAsyncLoggerConfigExceptionHandler
+        implements ExceptionHandler<AsyncLoggerConfigDisruptor.Log4jEventWrapper> {
+
+    @Override
+    public void handleEventException(final Throwable throwable, final long sequence,
+            final AsyncLoggerConfigDisruptor.Log4jEventWrapper event) {
+        StringBuilder sb = new StringBuilder(512);
+        sb.append("AsyncLogger error handling event seq=").append(sequence).append(", value='");
+        try {
+            sb.append(event);
+        } catch (Exception ignored) {
+            sb.append("[ERROR calling ").append(event.getClass()).append(".toString(): ");
+            sb.append(ignored).append("]");
+        }
+        sb.append("':");
+        System.err.println(sb);
+        throwable.printStackTrace();
+    }
+
+    @Override
+    public void handleOnStartException(final Throwable throwable) {
+        System.err.println("AsyncLogger error starting:");
+        throwable.printStackTrace();
+    }
+
+    @Override
+    public void handleOnShutdownException(final Throwable throwable) {
+        System.err.println("AsyncLogger error shutting down:");
+        throwable.printStackTrace();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cf2de969/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerExceptionHandler.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerExceptionHandler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerExceptionHandler.java
new file mode 100644
index 0000000..48dea13
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncLoggerExceptionHandler.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.async;
+
+import com.lmax.disruptor.ExceptionHandler;
+
+/**
+ * Default disruptor exception handler for errors that occur in the AsyncLogger background thread.
+ */
+public class DefaultAsyncLoggerExceptionHandler implements ExceptionHandler<RingBufferLogEvent> {
+
+    @Override
+    public void handleEventException(final Throwable throwable, final long sequence, final RingBufferLogEvent event) {
+        StringBuilder sb = new StringBuilder(512);
+        sb.append("AsyncLogger error handling event seq=").append(sequence).append(", value='");
+        try {
+            sb.append(event);
+        } catch (Exception ignored) {
+            sb.append("[ERROR calling ").append(event.getClass()).append(".toString(): ");
+            sb.append(ignored).append("]");
+        }
+        sb.append("':");
+        System.err.println(sb);
+        throwable.printStackTrace();
+    }
+
+    @Override
+    public void handleOnStartException(final Throwable throwable) {
+        System.err.println("AsyncLogger error starting:");
+        throwable.printStackTrace();
+    }
+
+    @Override
+    public void handleOnShutdownException(final Throwable throwable) {
+        System.err.println("AsyncLogger error shutting down:");
+        throwable.printStackTrace();
+    }
+}