You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2015/10/24 01:19:57 UTC

Fwd: logging-log4j2 git commit: LOG4J2-493 better status debug logging during disruptor start/stop

When I see a log message like:

---------- Forwarded message ----------
From: <rp...@apache.org>
Date: Fri, Oct 23, 2015 at 9:10 AM
Subject: logging-log4j2 git commit: LOG4J2-493 better status debug logging
during disruptor start/stop
To: commits@logging.apache.org


Repository: logging-log4j2
Updated Branches:
  refs/heads/master c705ffdc1 -> d8ede120f


LOG4J2-493 better status debug logging during disruptor start/stop

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

Branch: refs/heads/master
Commit: d8ede120f066f1112467717d724e9d9627dde675
Parents: c705ffd
Author: rpopma <rp...@apache.org>
Authored: Sat Oct 24 01:10:18 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Oct 24 01:10:18 2015 +0900

----------------------------------------------------------------------
 .../logging/log4j/core/async/AsyncLoggerHelper.java   | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d8ede120/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java
----------------------------------------------------------------------
diff --git
a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java
b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java
index 5c90eae..bd8508a 100644
---
a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java
+++
b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerHelper.java
@@ -75,10 +75,11 @@ class AsyncLoggerHelper {
      */
     synchronized void start() {
         if (disruptor != null) {
-            LOGGER.trace("[{}] AsyncLoggerHelper not starting new
disruptor, using existing object.", contextName);
+            LOGGER.trace("[{}] AsyncLoggerHelper not starting new
disruptor for this context, using existing object.",
+                    contextName);
             return;
         }
-        LOGGER.trace("[{}] AsyncLoggerHelper creating new disruptor.",
contextName);
+        LOGGER.trace("[{}] AsyncLoggerHelper creating new disruptor for
this context.", contextName);
         final int ringBufferSize = calculateRingBufferSize();
         final WaitStrategy waitStrategy = createWaitStrategy();
         executor = Executors.newSingleThreadExecutor(new
DaemonThreadFactory("AsyncLogger[" + contextName + "]"));
@@ -94,7 +95,7 @@ class AsyncLoggerHelper {
         disruptor.handleEventsWith(handlers);

         LOGGER.debug(
-                       "[{}] Starting AsyncLogger disruptor with
ringbufferSize={}, waitStrategy={}, exceptionHandler={}...",
+                       "[{}] Starting AsyncLogger disruptor for this
context with ringbufferSize={}, waitStrategy={}, exceptionHandler={}...",
                        contextName,
disruptor.getRingBuffer().getBufferSize(),
waitStrategy.getClass().getSimpleName(),
                        errorHandler);
         disruptor.start();
@@ -182,13 +183,12 @@ class AsyncLoggerHelper {
     synchronized void stop() {
         final Disruptor<RingBufferLogEvent> temp = getDisruptor();
         if (temp == null) {
-            LOGGER.trace("[{}] AsyncLoggerHelper: disruptor already shut
down.", contextName);
+            LOGGER.trace("[{}] AsyncLoggerHelper: disruptor for this
context already shut down.", contextName);
             return; // disruptor was already shut down by another thread
         }
-        LOGGER.debug("[{}] AsyncLoggerHelper: shutting down disruptor.",
contextName);
+        LOGGER.debug("[{}] AsyncLoggerHelper: shutting down disruptor for
this context.", contextName);

-        // Must guarantee that publishing to the RingBuffer has stopped
-        // before we call disruptor.shutdown()
+        // We must guarantee that publishing to the RingBuffer has stopped
before we call disruptor.shutdown().
         disruptor = null; // client code fails with NPE if log after stop.
This is by design.

         // Calling Disruptor.shutdown() will wait until all enqueued
events are fully processed,




-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory