Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Documentation ErrorLogging Stuff:


- ZfExtended_Logger Base Class surround logging

- provides functions like fatal, error, warn, info, debug, trace for direct log output

- provides a function exception to log exceptions, this is automatically invoked in the final exception handler

- A global ZfExtended_Logger instance is set up via Resource Plugin, with Zend_Registry::get('logger'); also via Zend getResource stuff

- This default system logger is configured via the ini config system (since its a Zend resource)

- There are configured the different writers

- One can also define additional Logger instances if needed with a different config as the default one

- Each writer can have a different filter configuration, one can configure one writer to listen on all import errors on error level debug and send them to one adress, another writer can listen to all events on level > warn to log them as usual


Writer:

The writers contain the filter logic (via config)

- The special writer editor_Logger_TaskWriter logs only events with extra['task'] set with an Task Entity to the own task log table, so that this events can be shown in the frontend


Exception Definition / Usage:

- Before the refactoring we had only a few Exceptions

- Now for each domain (import / export / Plugin XY) one or more Exceptions should be defined.

- Each Exception has a different domain (example: import.fileparser.sdlxliff) for filtering.

- Also the Exception carries Semantik through its type, only if needed. Example:

  Plugin_Demo_Exception > A general Exception in the Demo Plugin Scope

  Plugin_Demo_NoConnectionException > On more specific errors (no connection established) specific exceptions can be created. Why that: If we can / want to handle that exceptions differently we can do that:

    try {

        $this->foo();

    }

    catch(Plugin_Demo_NoConnectionException $e) {

        //handle the no connection error

        logger::exceptionHandled($e); //logs the exception on level debug and marks the logged Exception as Handled.

    }

    // Plugin_Demo_Exception are handled via the final handler and stops the PHP request

  • No labels