Log4php
  1. Log4php
  2. LOG4PHP-111

Problem using a custom ConversionPattern

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.1.0
    • Component/s: Code
    • Labels:
      None
    • Environment:

      Windows 7 32-bits, PHP5.3.0, Apache 2.2.11

      Description

      When using this layout in a XML config file :
      <layout class="LoggerLayoutPattern">
      <param name="ConversionPattern" value="%d

      {d/m/Y H:i:s,u}

      [%t] [%p] : %m" />
      </layout>

      Logged messages carret doesn't go to the next line, generating this kind of log file :
      09/04/2010 17:39:51,056 [4088] [INFO] : Admin [8 | maxime@edencast.com] logged to the administration12/04/2010 12:14:19,940 [3668] [INFO] : Admin [1 | admin@edencast.com] logged to the administration12/04/2010 12:15:24,582 [3668] [INFO] : Admin [1 | admin@edencast.com] validated comments ids : [18]12/04/2010 12:16:09,875 [3668] [INFO] : Admin [1 | admin@edencast.com] validated comments ids : [16]15/04/2010 11:35:55,697 [2112] [INFO] : Admin [8 | maxime@edencast.com] logged to the administration15/04/2010 11:38:42,501 [2112] [INFO] : Admin [1 | admin@edencast.com] logged to the administration16/04/2010 09:51:30,161 [2112] [INFO] : Admin [8 | maxime@edencast.com] logged to the administration16/04/2010 09:52:09,751 [2112] [INFO] : Admin [1 | admin@edencast.com] logged to the administration

        Activity

        Hide
        Ivan Habunek added a comment -

        You need to add %n to the end of your conversion pattern, like this:

        <param name="ConversionPattern" value="%d

        {d/m/Y H:i:s,u}

        [%t] [%p] : %m%n" />

        I figured this looking at the examples, but I can't find it in the docs. This may be a documentation issue.
        http://logging.apache.org/log4php/apidocs/log4php/layouts/LoggerLayoutPattern.html

        Show
        Ivan Habunek added a comment - You need to add %n to the end of your conversion pattern, like this: <param name="ConversionPattern" value="%d {d/m/Y H:i:s,u} [%t] [%p] : %m%n" /> I figured this looking at the examples, but I can't find it in the docs. This may be a documentation issue. http://logging.apache.org/log4php/apidocs/log4php/layouts/LoggerLayoutPattern.html
        Hide
        Christian Grobmeier added a comment -

        Thanks Ivan!

        I have added a note on the appender-layout documentation on that

        Show
        Christian Grobmeier added a comment - Thanks Ivan! I have added a note on the appender-layout documentation on that

          People

          • Assignee:
            Unassigned
            Reporter:
            Maxime Faye
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development