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

TimeBasedRollingPolicy doesn't seem to like file names with '(' in them

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • None
    • logback-core
    • None
    • Windows XP (x64). Java 6 (32 bit), Tomcat6 (in case you care)

    Description

      Apologies if this is PEBKAC

      I configured up my appender like this:

      <appender name="DS_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
      <File>/discoveryService.log</File>
      <ImmediateFlush>true</ImmediateFlush>

      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <FileNamePattern>C:\Program Files (x86)\DS/logs/discovery-%d

      {yyyy-MM-dd}.log</FileNamePattern>
      </rollingPolicy>

      <layout class="ch.qos.logback.classic.PatternLayout">
      <Pattern>%date{HH:mm:ss.SSS} %level [%logger] %msg%n%ex{full}%n</Pattern>
      </layout>
      </appender>

      The slightly odd "C:\Program Files (x86)\" is where Windows64 puts 32 bit executable (and it things that Tomcat it). This failed. Due to my own programs limitations it took me a while to get there, but this was because of this statement:

      DateTokenConverter dtc = fileNamePattern.getDateTokenConverter();

      if (dtc == null) { throw new IllegalStateException("FileNamePattern [" + fileNamePattern.getPattern() + "] does not contain a valid DateToken"); }

      when I poked into fileNamePattern.getDateTokenConverter(); I see this:

      this FileNamePattern (id=159)
      context LoggerContext (id=80)
      headTokenConverter LiteralConverter<E> (id=160)
      literal "C:\Program Files (x86"
      next null
      noContextWarning 0 [0x0]
      pattern "C:\Program Files (x86)\DS/logs/discovery-%d{yyyy-MM-dd}

      .log"

      Note that headTokenConverter is malformed, and so we end up with a null dtc.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            rodwiddowson Rod Widdowson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: