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

Appenders do not close gracefully if a fatal error occurs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None

      Description

      LoggerAppenderMail doesn't send out messages if script dies

      Due to the way it buffers messages until the end of the script, if the PHP script unexpectedly dies, the buffered messages are not sent out since destructors are not called when E_FATAL errors occur.

      1. LOG4PHP-159.patch
        0.5 kB
        Justin Cherniak

        Activity

        Hide
        jcherniak Justin Cherniak added a comment -

        Proposed patch for the issue. Calling register_shutdown_function ensures that the appender is closed, even if an E_FATAL error occurs.

        Show
        jcherniak Justin Cherniak added a comment - Proposed patch for the issue. Calling register_shutdown_function ensures that the appender is closed, even if an E_FATAL error occurs.
        Hide
        juice Ivan Habunek added a comment -

        Hm, not a bad idea. Maybe it can be applied on the parent LoggerAppender class so it works with all appenders... I will look into it.

        Show
        juice Ivan Habunek added a comment - Hm, not a bad idea. Maybe it can be applied on the parent LoggerAppender class so it works with all appenders... I will look into it.
        Hide
        juice Ivan Habunek added a comment -

        It's done. I have implemented your fix in the LoggerAppender constructor so it will be applied to all appenders. Also removed the destructor so that close() is not called twice.

        Show
        juice Ivan Habunek added a comment - It's done. I have implemented your fix in the LoggerAppender constructor so it will be applied to all appenders. Also removed the destructor so that close() is not called twice.

          People

          • Assignee:
            juice Ivan Habunek
            Reporter:
            jcherniak Justin Cherniak
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development