Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1473

%caller broken for lambdas in latest alpha release

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.0-alpha0, 1.3.0-alpha1, 1.3.0-alpha3, 1.3.0-alpha4
    • Fix Version/s: None
    • Component/s: logback-core
    • Labels:
      None
    • Environment:

      Any, easy to reproduce

      Description

      %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

      https://github.com/deanhiller/webpieces/blob/logbackBugs/webserver/webpiecesServerBuilder/templateProject/WEBPIECESxAPPNAME-dev/src/main/java/WEBPIECESxPACKAGE/DevelopmentServer.java

      We have the following pattern

      https://github.com/deanhiller/webpieces/blob/logbackBugs/webserver/webpiecesServerBuilder/templateProject/WEBPIECESxAPPNAME-dev/src/main/resources/logback.xml

      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

       

        Attachments

          Activity

            People

            • Assignee:
              logback-dev Logback dev list
              Reporter:
              deanhiller Dean Hiller
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: