Log4j ->Logstash problem with "LocationInfo is not allowed" exception

When I use log4j sends log event to Logstash , a problem ("exception=>java.io.InvalidObjectException: Object type org.apache.log4j.spi.LocationInfo is not allowed.") is encountered. Anyone could help me ? thanks!
BTW: Both log4j 1.x and log4j 2.x encountered the same problem...

Log4j conf:

<?xml version="1.0" encoding="UTF-8"?>
<Appenders>
    <Console name="out" target="SYSTEM_OUT">  
        <PatternLayout pattern="%d{yyyy-MMM-dd HH:mm:ss} [%t] %-5p: %m%n"></PatternLayout>  
    </Console>
    <Socket name="A1" host="10.10.11.12" port="5000">
        <JSONLayout/>
    </Socket>
</Appenders>
<Loggers>
    <root level="trace">  
        <AppenderRef ref="out" />
        <AppenderRef ref="A1" />
    </root>  
</Loggers>  

Logstash conf: (logstash version: 5.3.2)
input {
log4j {
host=>"10.10.11.12"
port=>5000
}
}

output {
elasticsearch {
hosts =>"10.10.11.13:9200"
index =>"log4j-message-%{+YYYY.MM.dd}"
}
stdout { codec => rubydebug }

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.