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/08/07 13:43:09 UTC
[1/2] logging-log4j2 git commit: reverting spelling
Repository: logging-log4j2
Updated Branches:
refs/heads/master 305827895 -> 2a46255fa
reverting spelling
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/fa39259a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/fa39259a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/fa39259a
Branch: refs/heads/master
Commit: fa39259a2f6e0e6b871b7e5372733404beec35b0
Parents: 3058278
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 7 22:30:09 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 7 22:30:09 2016 +0900
----------------------------------------------------------------------
.../src/main/java/org/apache/logging/log4j/util/Constants.java | 2 +-
.../logging/log4j/core/appender/MemoryMappedFileAppender.java | 2 +-
.../logging/log4j/core/appender/RandomAccessFileAppender.java | 2 +-
.../log4j/core/appender/RollingRandomAccessFileAppender.java | 2 +-
.../logging/log4j/core/async/AsyncQueueFullPolicyFactory.java | 4 ++--
.../main/java/org/apache/logging/log4j/core/util/Constants.java | 4 ++--
6 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fa39259a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java
index 1351129..1614057 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java
@@ -31,7 +31,7 @@ public final class Constants {
"log4j2.is.webapp", isClassAvailable("javax.servlet.Servlet"));
/**
- * Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behavior.
+ * Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.
* <p>
* {@code True} for non-{@link #IS_WEB_APP web apps}, disable by setting system property
* "log4j2.enable.threadlocals" to "false".
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fa39259a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java
index 3270e29..0949ffd 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppender.java
@@ -81,7 +81,7 @@ public final class MemoryMappedFileAppender extends AbstractOutputStreamAppender
@Override
public void append(final LogEvent event) {
- // Leverage the nice batching behavior of async Loggers/Appenders:
+ // Leverage the nice batching behaviour of async Loggers/Appenders:
// we can signal the file manager that it needs to flush the buffer
// to disk at the end of a batch.
// From a user's point of view, this means that all log events are
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fa39259a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java
index dcceb0d..738816d 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java
@@ -77,7 +77,7 @@ public final class RandomAccessFileAppender extends AbstractOutputStreamAppender
@Override
public void append(final LogEvent event) {
- // Leverage the nice batching behavior of async Loggers/Appenders:
+ // Leverage the nice batching behaviour of async Loggers/Appenders:
// we can signal the file manager that it needs to flush the buffer
// to disk at the end of a batch.
// From a user's point of view, this means that all log events are
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fa39259a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
index 2f8c805..67777e6 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RollingRandomAccessFileAppender.java
@@ -87,7 +87,7 @@ public final class RollingRandomAccessFileAppender extends AbstractOutputStreamA
final RollingRandomAccessFileManager manager = getManager();
manager.checkRollover(event);
- // Leverage the nice batching behavior of async Loggers/Appenders:
+ // Leverage the nice batching behaviour of async Loggers/Appenders:
// we can signal the file manager that it needs to flush the buffer
// to disk at the end of a batch.
// From a user's point of view, this means that all log events are
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fa39259a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactory.java
index e8d7d5c..534a899 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactory.java
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.util.PropertiesUtil;
* created by this factory is used in AsyncLogger, AsyncLoggerConfig and AsyncAppender
* to control if events are logged in the current thread, the background thread, or discarded.
* <p>
- * Property {@code "log4j2.AsyncQueueFullPolicy"} controls the routing behavior. If this property is not specified or has
+ * Property {@code "log4j2.AsyncQueueFullPolicy"} controls the routing behaviour. If this property is not specified or has
* value {@code "Default"}, this factory creates {@link DefaultAsyncQueueFullPolicy} objects.
* </p> <p>
* If this property has value {@code "Discard"}, this factory creates {@link DiscardingAsyncQueueFullPolicy} objects.
@@ -53,7 +53,7 @@ public class AsyncQueueFullPolicyFactory {
/**
* Creates and returns {@link AsyncQueueFullPolicy} instances based on user-specified system properties.
* <p>
- * Property {@code "log4j2.AsyncQueueFullPolicy"} controls the routing behavior. If this property is not specified or
+ * Property {@code "log4j2.AsyncQueueFullPolicy"} controls the routing behaviour. If this property is not specified or
* has value {@code "Default"}, this method returns {@link DefaultAsyncQueueFullPolicy} objects.
* </p> <p>
* If this property has value {@code "Discard"}, this method returns {@link DiscardingAsyncQueueFullPolicy} objects.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fa39259a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java
index ab10360..09ec0bb 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java
@@ -79,7 +79,7 @@ public final class Constants {
public static final boolean IS_WEB_APP = org.apache.logging.log4j.util.Constants.IS_WEB_APP;
/**
- * Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behavior.
+ * Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour.
* <p>
* {@code True} for non-{@link #IS_WEB_APP web apps}, disable by setting system property
* "log4j2.enable.threadlocals" to "false".
@@ -89,7 +89,7 @@ public final class Constants {
public static final boolean ENABLE_THREADLOCALS = org.apache.logging.log4j.util.Constants.ENABLE_THREADLOCALS;
/**
- * Kill switch for garbage-free Layout behavior that encodes LogEvents directly into
+ * Kill switch for garbage-free Layout behaviour that encodes LogEvents directly into
* {@link org.apache.logging.log4j.core.layout.ByteBufferDestination}s without creating intermediate temporary
* Objects.
* <p>
[2/2] logging-log4j2 git commit: LOG4J2-1448 Allow comma separated
agents, host list to be passed to FlumeAppender. This closes #32
(https://github.com/apache/logging-log4j2/pull/32)
Posted by rp...@apache.org.
LOG4J2-1448 Allow comma separated agents, host list to be passed to FlumeAppender.
This closes #32 (https://github.com/apache/logging-log4j2/pull/32)
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2a46255f
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2a46255f
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2a46255f
Branch: refs/heads/master
Commit: 2a46255fac6bca654558d44a84687191d2b644a9
Parents: fa39259
Author: rpopma <rp...@apache.org>
Authored: Sun Aug 7 22:43:13 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Aug 7 22:43:13 2016 +0900
----------------------------------------------------------------------
.../log4j/flume/appender/FlumeAppender.java | 41 ++++++++++++--------
src/changes/changes.xml | 3 ++
2 files changed, 28 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2a46255f/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java
----------------------------------------------------------------------
diff --git a/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java b/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java
index 7c5e364..2141681 100644
--- a/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java
+++ b/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java
@@ -163,6 +163,7 @@ public final class FlumeAppender extends AbstractAppender implements FlumeEventF
@PluginFactory
public static FlumeAppender createAppender(@PluginElement("Agents") Agent[] agents,
@PluginElement("Properties") final Property[] properties,
+ @PluginAttribute("hosts") final String hosts,
@PluginAttribute("embedded") final String embedded,
@PluginAttribute("type") final String type,
@PluginAttribute("dataDir") final String dataDir,
@@ -188,7 +189,7 @@ public final class FlumeAppender extends AbstractAppender implements FlumeEventF
@PluginElement("Filter") final Filter filter) {
final boolean embed = embedded != null ? Boolean.parseBoolean(embedded) :
- (agents == null || agents.length == 0) && properties != null && properties.length > 0;
+ (agents == null || agents.length == 0 || hosts == null || hosts.isEmpty()) && properties != null && properties.length > 0;
final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
final boolean compress = Booleans.parseBoolean(compressBody, true);
ManagerType managerType;
@@ -242,27 +243,15 @@ public final class FlumeAppender extends AbstractAppender implements FlumeEventF
manager = FlumeEmbeddedManager.getManager(name, agents, properties, batchCount, dataDir);
break;
case AVRO:
- if (agents == null || agents.length == 0) {
- LOGGER.debug("No agents provided, using defaults");
- agents = new Agent[] {Agent.createAgent(null, null)};
- }
- manager = FlumeAvroManager.getManager(name, agents, batchCount, delayMillis, retries, connectTimeoutMillis, reqTimeoutMillis);
+ manager = FlumeAvroManager.getManager(name, getAgents(agents, hosts), batchCount, delayMillis, retries, connectTimeoutMillis, reqTimeoutMillis);
break;
case PERSISTENT:
- if (agents == null || agents.length == 0) {
- LOGGER.debug("No agents provided, using defaults");
- agents = new Agent[] {Agent.createAgent(null, null)};
- }
- manager = FlumePersistentManager.getManager(name, agents, properties, batchCount, retries,
+ manager = FlumePersistentManager.getManager(name, getAgents(agents, hosts), properties, batchCount, retries,
connectTimeoutMillis, reqTimeoutMillis, delayMillis, lockTimeoutRetryCount, dataDir);
break;
default:
LOGGER.debug("No manager type specified. Defaulting to AVRO");
- if (agents == null || agents.length == 0) {
- LOGGER.debug("No agents provided, using defaults");
- agents = new Agent[] {Agent.createAgent(null, null)};
- }
- manager = FlumeAvroManager.getManager(name, agents, batchCount, delayMillis, retries, connectTimeoutMillis, reqTimeoutMillis);
+ manager = FlumeAvroManager.getManager(name, getAgents(agents, hosts), batchCount, delayMillis, retries, connectTimeoutMillis, reqTimeoutMillis);
}
if (manager == null) {
@@ -272,4 +261,24 @@ public final class FlumeAppender extends AbstractAppender implements FlumeEventF
return new FlumeAppender(name, filter, layout, ignoreExceptions, includes,
excludes, required, mdcPrefix, eventPrefix, compress, factory, manager);
}
+
+ private static Agent[] getAgents(Agent[] agents, final String hosts) {
+ if (agents == null || agents.length == 0) {
+ if (hosts != null && !hosts.isEmpty()) {
+ LOGGER.debug("Parsing agents from hosts parameter");
+ String[] hostports = hosts.split(",");
+ agents = new Agent[hostports.length];
+ for(int i = 0; i < hostports.length; ++i) {
+ String[] h = hostports[i].split(":");
+ agents[i] = Agent.createAgent(h[0], h.length > 1 ? h[1] : null);
+ }
+ } else {
+ LOGGER.debug("No agents provided, using defaults");
+ agents = new Agent[] {Agent.createAgent(null, null)};
+ }
+ }
+
+ LOGGER.debug("Using agents {}", agents);
+ return agents;
+ }
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2a46255f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 77bc02b..87578dd 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
</properties>
<body>
<release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+ <action issue="LOG4J2-1448" dev="rpopma" type="fix" due-to="Keith Laban">
+ Allow comma separated agents, host list to be passed to FlumeAppender.
+ </action>
<action issue="LOG4J2-1500" dev="ggregory" type="fix" due-to="Jose Leon">
Merging configurations fail with an NPE when comparing Nodes with different attributes.
</action>