Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

PortUnreachableException is logged as ERROR null via Log4j2 #126

Closed
gjakovljevic opened this issue Jan 22, 2018 · 2 comments
Closed

PortUnreachableException is logged as ERROR null via Log4j2 #126

gjakovljevic opened this issue Jan 22, 2018 · 2 comments
Labels
type: bug A general bug

Comments

@gjakovljevic
Copy link

Having configured application to use GELF UDP transport and pointing it to a GrayLog server that is currently down produces "null" message after every attempt to send message to log server.

Messages are logged through log4j2 StatusLogger on ERROR level / there is no stack trace associated so I cannot pinpoint location in logger code that produces such message.

logstash-gelf version is 1.11.1 downloaded from Maven central repository.

Configuration is as follows:

Add graylog appender

appender.graylog2.type=Gelf
appender.graylog2.name=graylog2
appender.graylog2.host=udp:somehost.somedomain.com
appender.graylog2.port=12201
appender.graylog2.version=1.1
appender.graylog2.facility=logstash-gelf
appender.graylog2.extractStackTrace=true
appender.graylog2.filterStackTrace=true
appender.graylog2.maximumMessageSize=10485760

add graylog appender to root logger

rootLogger.appenderRef.graylog2.ref = graylog2

Steps to reproduce:

  1. prepare log4j2 configuration as above / use valid hostname but use port that nothing is bound to or use real port but shutdown GrayLog instance
  2. start application that should send logs to GrayLog
  3. observe "ERROR null" messages in console
@mp911de mp911de added the type: bug A general bug label Jan 29, 2018
@mp911de
Copy link
Owner

mp911de commented Jan 29, 2018

Let me see whether I can reproduce the issue.

@mp911de
Copy link
Owner

mp911de commented Jan 29, 2018

You' see null because a PortUnreachableException is raised with no message. I will do two things here:

  1. Report PortUnreachableException with a meaningful message
  2. Make sure that null messages report at least the exception name

@mp911de mp911de changed the title "null" log messages in console when GrayLog server is down PortUnreachableException is logged as ERROR null via Log4j2 Jan 29, 2018
@mp911de mp911de added this to the logstash-gelf 1.11.2 milestone Jan 29, 2018
@mp911de mp911de closed this as completed Jan 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants