LOG4J2-323 improved helper status logging Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/129ae4aa Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/129ae4aa Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/129ae4aa
Branch: refs/heads/master Commit: 129ae4aae60ba1dc0c9dc9a87fde6caca35e7f6c Parents: 6b7e138 Author: rpopma <rpo...@apache.org> Authored: Fri Oct 23 23:16:21 2015 +0900 Committer: rpopma <rpo...@apache.org> Committed: Fri Oct 23 23:16:21 2015 +0900 ---------------------------------------------------------------------- .../core/async/AsyncLoggerConfigHelper.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/129ae4aa/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java index 6636eba..1efdd18 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigHelper.java @@ -116,22 +116,23 @@ class AsyncLoggerConfigHelper implements AsyncLoggerConfigDelegate { disruptor.handleEventsWith(handlers); LOGGER.debug( - "Starting AsyncLoggerConfig disruptor with ringbuffer size={}, waitStrategy={}, exceptionHandler={}...", + "Starting AsyncLoggerConfig disruptor with ringbufferSize={}, waitStrategy={}, exceptionHandler={}...", disruptor.getRingBuffer().getBufferSize(), waitStrategy.getClass().getSimpleName(), errorHandler); disruptor.start(); } private static WaitStrategy createWaitStrategy() { final String strategy = System.getProperty("AsyncLoggerConfig.WaitStrategy"); - LOGGER.trace("property AsyncLoggerConfig.WaitStrategy={}", strategy); - if ("Sleep".equals(strategy)) { - return new SleepingWaitStrategy(); - } else if ("Yield".equals(strategy)) { - return new YieldingWaitStrategy(); - } else if ("Block".equals(strategy)) { - return new BlockingWaitStrategy(); + if (strategy != null) { + LOGGER.trace("property AsyncLoggerConfig.WaitStrategy={}", strategy); + if ("Sleep".equals(strategy)) { + return new SleepingWaitStrategy(); + } else if ("Yield".equals(strategy)) { + return new YieldingWaitStrategy(); + } else if ("Block".equals(strategy)) { + return new BlockingWaitStrategy(); + } } - LOGGER.trace("AsyncLoggerConfigHelper disruptor event handler uses BlockingWaitStrategy"); return new BlockingWaitStrategy(); }