logging-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abrasha <...@git.apache.org>
Subject [GitHub] logging-log4j2 pull request #112: LOG4J2-2062 Added property to KafkaAppende...
Date Fri, 06 Oct 2017 19:52:50 GMT
Github user Abrasha commented on a diff in the pull request:

    https://github.com/apache/logging-log4j2/pull/112#discussion_r143281153
  
    --- Diff: log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java
---
    @@ -47,18 +47,24 @@
         private final int timeoutMillis;
     
         private final String topic;
    +    private final byte[] key;
         private final boolean syncSend;
     
    -    public KafkaManager(final LoggerContext loggerContext, final String name, final String
topic, final boolean syncSend, final Property[] properties) {
    +    public KafkaManager(final LoggerContext loggerContext, final String name, final String
topic, final boolean syncSend,
    +                        final Property[] properties, final String key) {
             super(loggerContext, name);
             this.topic = Objects.requireNonNull(topic, "topic");
             this.syncSend = syncSend;
             config.setProperty("key.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
             config.setProperty("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
             config.setProperty("batch.size", "0");
             for (final Property property : properties) {
    +
                 config.setProperty(property.getName(), property.getValue());
             }
    +
    +        this.key = (key != null ) ? key.getBytes() : null ;
    --- End diff --
    
    For example: `java.nio.charset.StandardCharsets.UTF_8`


---

Mime
View raw message