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

%file and %line not set when using SMTPAppender

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.6
    • Fix Version/s: 1.0.7
    • Component/s: logback-classic
    • Environment:

      Win 7 (64bit), IDE - Netbeans 7.2, JDK 1.6

      Description

      When using the SMTPAppender as such:

      <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
      <smtpHost>1.1.1.1</smtpHost>
      <to>blah@blah</to>
      <from>blah@blah</from>
      <subject>TESTING: %logger

      {36} - %m</subject>

      <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%d{yyyyMMddHHmm:ss} %level [%thread] %logger{36}

      [%file:%line] %msg%n</pattern>
      </layout>
      </appender>

      The resulting log prints out like so:

      201208161255:43 DEBUG [main] LoggingStuff.Foo [?:?] Did it again!
      201208161255:43 INFO [main] LoggingStuff.Foo [?:?] Ha info - do it
      201208161255:43 WARN [main] LoggingStuff.Foo [?:?] Something is about to happen!
      201208161255:43 ERROR [main] LoggingStuff.Foo [?:?] Serious stuff - is it?
      java.lang.Exception: Yep
      at LoggingStuff.Foo.doIt(Foo.java:56) [classes/:na]
      at LoggingStuff.MyApp1.main(MyApp1.java:39) [classes/:na]

      Where the %file and %line parameters are not set and show up as a '?'.

        Attachments

          Activity

            People

            • Assignee:
              logback-dev Logback dev list
              Reporter:
              hogartyp Patrick Hogarty
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: