Log4cxx
  1. Log4cxx
  2. LOGCXX-308

I can not print millisecond with %Q

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: Layout
    • Labels:
      None
    • Environment:
      uname -a
      SunOS netra01 5.8 Generic_108528-17 sun4u sparc SUNW,UltraAX-i2
      CC -V
      CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-03 2001/10/19

      Description

      In log4cxx 0.9.7, I can print millisecond with "%Q"
      For example, %d

      {%Y-%m-%d %H:%M:%S.%Q}

      will print "2008-07-27 02:03:45.080"
      But in 0.10.0, "%Q" does not work and the result is "2008-07-27 02:03:45.%Q".
      My platform is sparc-solaris8 CC5.3

        Activity

        Hide
        Thorsten Schöning added a comment -

        I close the bug because I couldn't find the mention of %Q in the docs anymore and the change was intended.

        Show
        Thorsten Schöning added a comment - I close the bug because I couldn't find the mention of %Q in the docs anymore and the change was intended.
        Hide
        Florian Seydoux added a comment -

        It's really by design that %Q is not supported anymore (cf. LOGCXX-40 and revision 308692.
        I feel only the documentation should be updated.

        Show
        Florian Seydoux added a comment - It's really by design that %Q is not supported anymore (cf. LOGCXX-40 and revision 308692. I feel only the documentation should be updated.
        Hide
        Chand Priyankara added a comment - - edited

        Does anyone has the reported platform and make verify this?
        I bother if this bug category is acceptable for this issue.

        Show
        Chand Priyankara added a comment - - edited Does anyone has the reported platform and make verify this? I bother if this bug category is acceptable for this issue.
        Hide
        Florian Seydoux added a comment -

        As the "workaround" proposed by Chand follows in fact the log4j format, based itself under the java SimpleDateFormat, I propose to close this issue (as 'Not a problem').
        It would be better to have confirmation from the reporter that the proposed pattern will work under his platform, but as the issue was opened long time ago...

        (Eventually, turn the ticked as API documentation task)

        Show
        Florian Seydoux added a comment - As the "workaround" proposed by Chand follows in fact the log4j format , based itself under the java SimpleDateFormat , I propose to close this issue (as 'Not a problem'). It would be better to have confirmation from the reporter that the proposed pattern will work under his platform, but as the issue was opened long time ago... (Eventually, turn the ticked as API documentation task)
        Hide
        chand priyankara added a comment -

        There is another workaround for getting Milliseconds.
        you can use SSS instead of %Q

        Ex:
        log4j.appender.testAppender.layout.ConversionPattern=%d

        {%Y-%m-%d HH:mm:ss.SSS}

        G – Era designator (AD)
        y – Year (e.g. 2005 or 05)
        M – Month in year (e.g. July or Jul or 07)
        w – Week in year (e.g. 29)
        W – Week in month (e.g. 4)
        D – Day in year (e.g. 199)
        d – Day in month (e.g. 18)
        F – Day of week in month (e.g. 2)
        E – Day in week (e.g. Tuesday or Tue)
        a – Am/pm marker (e.g. PM)
        H – Hour in day (0-23)
        k – Hour in day (1-24)
        K – Hour in am/pm (0-11)
        h – Hour in am/pm (1-12)
        m – Minute in hour (0-59)
        s – Second in minute (0-59)
        S – Millisecond (0-999)
        z – Time zone (e.g. "Pacific Standard Time" or "PST" or "GMT-08:00")
        Z – RFC 822 Time zone (e.g. "-0800")

        Show
        chand priyankara added a comment - There is another workaround for getting Milliseconds. you can use SSS instead of %Q Ex: log4j.appender.testAppender.layout.ConversionPattern=%d {%Y-%m-%d HH:mm:ss.SSS} G – Era designator (AD) y – Year (e.g. 2005 or 05) M – Month in year (e.g. July or Jul or 07) w – Week in year (e.g. 29) W – Week in month (e.g. 4) D – Day in year (e.g. 199) d – Day in month (e.g. 18) F – Day of week in month (e.g. 2) E – Day in week (e.g. Tuesday or Tue) a – Am/pm marker (e.g. PM) H – Hour in day (0-23) k – Hour in day (1-24) K – Hour in am/pm (0-11) h – Hour in am/pm (1-12) m – Minute in hour (0-59) s – Second in minute (0-59) S – Millisecond (0-999) z – Time zone (e.g. "Pacific Standard Time" or "PST" or "GMT-08:00") Z – RFC 822 Time zone (e.g. "-0800")

          People

          • Assignee:
            Chand Priyankara
            Reporter:
            Yihong Zhan
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development