[logback-dev] [JIRA] (LOGBACK-1473) %caller broken for lambdas in latest alpha release

QOS.CH (JIRA) noreply-jira at qos.ch
Mon Jul 1 17:31:00 CEST 2019

Dean Hiller created LOGBACK-1473:

             Summary: %caller broken for lambdas in latest alpha release
                 Key: LOGBACK-1473
                 URL: https://jira.qos.ch/browse/LOGBACK-1473
             Project: logback
          Issue Type: Bug
          Components: logback-core
    Affects Versions: 1.3.0-alpha4, 1.3.0-alpha3, 1.3.0-alpha1, 1.3.0-alpha0
         Environment: Any, easy to reproduce
            Reporter: Dean Hiller
            Assignee: Logback dev list

%caller is an amazing feature!!!  We install logback/slf4j as the defacto standard in [https://github.com/deanhiller/webpieces] AND more importantly, on the DevelopmentServer (recompiles code live as the server is running), we use the pattern %caller such that Developers can 'click' on any log statement and it takes them in their IDE right to that class file and log line.  This works in intellij and in Eclipse wonderfully.

So, off the branch logbackBugs, we have this class with line numbers


We have the following pattern


which is 

%date\{ISO8601} [%thread][%X\{socket}] [%X\{txId}-%X\{user}] *%caller\{1}* %-4level: %message%n

The output of running that program is

2019-07-01 09:21:00,716 [main][] [-] Caller+0 at WEBPIECESxPACKAGE.DevelopmentServer.main(DevelopmentServer.java:17)

INFO: Starting Development Server under java version=11.0.3

2019-07-01 09:21:00,720 [main][] [-] Caller+0 at org.slf4j.spi.DefaultLoggingEventBuilder.logViaPublicLoggerAPI(DefaultLoggingEventBuilder.java:120)

INFO: testing out %caller\{1}

2019-07-01 09:21:00,721 [main][] [-] Caller+0 at org.slf4j.spi.DefaultLoggingEventBuilder.logViaPublicLoggerAPI(DefaultLoggingEventBuilder.java:120)


NOTICE that the first log line is correct.  Our log is from line 17 in DevelopmentServer.java.  The second line is logging incorrectly(ie. I personally think logback should adjust for this as it can tell if the lambda method was called or not as it already is looking at the stack trace).

We would love to upgrade to slf4j2 but this was a huge feature in using our DevelopmentServer.  It works like ruby where you just keep coding and never restart the server and COMBINED with this amazing caller feature, you can click any logs to go right to the log statement which has been amazing.


NOTES: If you like, it is very easy to run the above program yourself like so
 * git clone [https://github.com/deanhiller/webpieces.git]
 * cd webpieces
 * git checkout logbackBugs
 * import into Intellij OR Eclipse via gradle (both are tested often and work)
 * Open DevelopmentServer.java and run it


This message was sent by Atlassian JIRA

More information about the logback-dev mailing list