Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1068

Exceptions not logged when using TcpSocketServer + SerializedLayout

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1, 2.2, 2.3
    • 2.4
    • Pattern Converters
    • None

    Description

      This issue was reported in BugZilla bug 57036: https://bz.apache.org/bugzilla/show_bug.cgi?id=57036. The description there covers the problem well:

      "... in the Method format(final LogEvent event, final StringBuilder toAppendTo) in ExtendedThrowablePatternConverter writing the Stacktrace in the logfile on condition that the Throwable throwable from Log4jLogEvent is not null, but on the Socketserver the Throwable throwable is always null, because it's defined as transient."

      I couldn't find the bug here in Jira, so I'm reporting again in case it has been lost in the migration.

      It's a major problem with a simple fix, so seems like it should be a high priority.

      I've worked around it for now by plugging in my own ExtendedThrowablePatternConverter. My fix is to change this line:

      if (throwable != null && options.anyLines() {

      to this:

      if ((throwable != null || proxy != null) && options.anyLines()) {

      Attachments

        1. patch.txt
          3 kB
          Andy McMullan

        Activity

          People

            Unassigned Unassigned
            andy@andymcm.com Andy McMullan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: