logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Leon (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LOG4J2-1493) Cannot set all appenders as async when including kafkaappender
Date Wed, 03 Aug 2016 20:33:20 GMT
Jose Leon created LOG4J2-1493:
---------------------------------

             Summary: Cannot set all appenders as async when including kafkaappender
                 Key: LOG4J2-1493
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1493
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.6.2
         Environment: all
            Reporter: Jose Leon


When I set this property:
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector

And use KafkaAppender like so:

<?xml version="1.0" encoding="UTF-8" ?>
<Configuration status="warn">
  <Appenders>
    <Kafka name="kafka" topic="${sys:kafka.topic}">
      <JsonLayout properties="true" locationInfo="true" complete="false" compact="true"
/>
      <Property name="bootstrap.servers">${sys:kafka.destinations}</Property>
      <Property name="hostname">${sys:hostname}</Property>
      <Property name="port">${sys:port}</Property>
      <Property name="instance">${sys:instance}</Property>
    </Kafka>
  </Appenders>

  <Loggers>
    <Logger name="org.apache.kafka" level="INFO" />

    <Root level="${sys:log.level}">
      <AppenderRef ref="kafka"/>
    </Root>
  </Loggers>

</Configuration>


I get this stacktrace and no appenders work; with the goal being to get the KafkaAppender
working at minimum

2016-08-03 20:31:15,607 Log4j2-AsyncLogger[AsyncContext@764c12b6]1 ERROR com.fasterxml.jackson.databind.JsonMappingException:
(was java.lang.NullPointerException) (through reference chain: org.apache.logging.log4j.core.async.RingBufferLogEvent["formattedMessage"])
com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException)
(through reference chain: org.apache.logging.log4j.core.async.RingBufferLogEvent["formattedMessage"])
        at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210)
        at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:177)
        at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:190)
        at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFieldsFiltered(BeanSerializerBase.java:724)
        at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:154)
        at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:129)
        at com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:1052)
        at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:905)
        at org.apache.logging.log4j.core.layout.AbstractJacksonLayout.toSerializable(AbstractJacksonLayout.java:83)
        at org.apache.logging.log4j.core.layout.JsonLayout.toSerializable(JsonLayout.java:937)
        at org.apache.logging.log4j.core.layout.AbstractJacksonLayout.toSerializable(AbstractJacksonLayout.java:63)
        at org.apache.logging.log4j.core.layout.JsonLayout.toSerializable(JsonLayout.java:801)
        at org.apache.logging.log4j.core.layout.AbstractJacksonLayout.toSerializable(AbstractJacksonLayout.java:33)
        at org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:253)
        at org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender.append(KafkaAppender.java:80)
        at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:155)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:119)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
        at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:390)
        at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:375)
        at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:359)
        at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:79)
        at org.apache.logging.log4j.core.async.AsyncLogger.actualAsyncLog(AsyncLogger.java:309)
        at org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:149)
        at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:45)
        at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:29)
        at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:128)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        at org.apache.logging.log4j.core.async.RingBufferLogEvent.getFormattedMessage(RingBufferLogEvent.java:213)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:536)
        at com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter.serializeAsField(SimpleBeanPropertyFilter.j



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message