t0xa / gelfj

Graylog Extended Log Format (GELF) implementation in Java and log4j appender without any dependencies.
https://github.com/t0xa/gelfj/wiki
Other
186 stars 116 forks source link

Common logging pattern log.warn(null, ex) doesn't work #58

Closed radimk closed 11 years ago

radimk commented 11 years ago

It is common to log exceptions without accompanying message like this:

    try {
      throw new IOException();
    } catch (Exception ex) {
      LOG.error(null, ex);
      throw new RuntimeException(ex);
    }

but the message is not processed by GELFJ. It is rejected by GelfMessage.isValid due to empty shortMessage field and while there is a test that seems to test this pattern is does not reveal the problem due to overriden behaviour in test sender.