Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following levels are defined as class constants  prefixed with LEVEL_ in ZfExtended_Logger class:

LevelAs NumberUsage example
FATAL1

FATAL PHP errors, other very fatal stuff, wrong PHP version or so

ERROR2common unhandled exceptions
WARN4User locked out due multiple wrong login, A user tries to edit a task property which he is not allowed to change
INFO8user entered wrong password, wanted exceptions BadMethodCall on known non existent methods (HEAD), other known and wanted exceptions
DEBUG16debugging on a level also useful for SysAdmins, for example user logins
TRACE32tracing debugging on a level only useful for developers

...

Code Block
titleCurrent writer configuration in application.ini
linenumberstrue
resources.ZfExtended_Resource_Logger.writer.default.type = 'ErrorLog'
resources.ZfExtended_Resource_Logger.writer.default.filter[] = "level <= 4debug" ; → warn logs from onlyfatal tillto warningdebug

; Test config:
resources.ZfExtended_Resource_Logger.writer.mail.type = 'DirectMail'
; via the formatter define what the user gets: full debug content, or only notice and so on.
resources.ZfExtended_Resource_Logger.writer.mail.filter[] = "level <= 2error" ; → warn logs from onlyfatal till error
resources.ZfExtended_Resource_Logger.writer.mail.receiver[] = 'sysadmin@example.com'
resources.ZfExtended_Resource_Logger.writer.mail.receiver[] = 'other-important-person@example.com'

resources.ZfExtended_Resource_Logger.writer.mail.type = 'Database'
; via the formatter define what the user gets: full debug content, or only notice and so on.
resources.ZfExtended_Resource_Logger.writer.mail.filter[] = "level <= 16debug" ; logs warnfrom logsfatal onlyto till errordebug


Code Block
titletask log writer config in application/modules/editor/configs/module.ini
resources.ZfExtended_Resource_Logger.writer.tasklog.type = 'editor_Logger_TaskWriter'
resources.ZfExtended_Resource_Logger.writer.tasklog.filter[] = "level <= 4warn" ; logs warnonly logsfrom onlyfatal tillto warning

; example for an additional filter to log from fatal to debug for events with an origin starting with "core.foo.bar"
resources.ZfExtended_Resource_Logger.writer.tasklog.filter[] = "level <= debug; origin ^= core.foo.bar" 

; The TaskWriter is a editor specific writer, it logs only events containing information about a task. The events are logged in a dedicated table, accessable via the frontend. Only warnings or events more severe as warnings are written to the task log. So no notices about tasks are additionally logged.
;


Code Block
languagephp
titleIn PHP just add new writters to the wanted logger instance
// use the default logger instance:
$logger = Zend_Registry::get('logger');
$logger->addWriter('name', $writerInstance);

Filtering


Logging Database Tables

Currently there are two database tables receiving events:

...