Log4php
  1. Log4php
  2. LOG4PHP-159

Appenders do not close gracefully if a fatal error occurs

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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
        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
        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.
        Hide
        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
        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
        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
        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.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development