Uploaded image for project: 'Log4php'
  1. Log4php
  2. LOG4PHP-16

Patch for LoggerAppenderSyslog to use Layouts

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.0
    • Code
    • None

    Description

      I noticed that LoggerAppenderSyslog seems to ignore layouts. I'm not sure if this is by design.

      The following patch causes LoggerAppenderSyslog to use layouts:

      Index: src/main/php/appenders/LoggerAppenderSyslog.php
      ===================================================================
      — src/main/php/appenders/LoggerAppenderSyslog.php (revision 677439)
      +++ src/main/php/appenders/LoggerAppenderSyslog.php (working copy)
      @@ -86,6 +86,11 @@
      */
      private $_overridePriority;

      + public function __construct($name)

      { + parent::__construct($name); + $this->requiresLayout = true; + }

      +
      /**

      • Set the ident of the syslog message.
        *
        @@ -156,7 +161,12 @@
        openlog($this->_ident, $this->_option, $this->_facility);

      $level = $event->getLevel();

      • $message = $event->getRenderedMessage();
        + if(null == $this->layout) { + $message = $event->getRenderedMessage(); + }

        + else

        { + $message = $this->layout->format($event); + }

      // If the priority of a syslog message can be overridden by a value defined in the properties-file,
      // use that value, else use the one that is defined in the code.

      Attachments

        1. LoggerAppenderSyslog.patch
          1 kB
          Gary Richardson

        Activity

          People

            kurdalen Knut Urdalen
            gary.richardson Gary Richardson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment