...
The following levels are defined as class constants prefixed with LEVEL_ in ZfExtended_Logger class:
Level | As Number | Usage example |
---|
FATAL | 1 | FATAL PHP errors, other very fatal stuff, wrong PHP version or so |
ERROR | 2 | common unhandled exceptions |
WARN | 4 | User locked out due multiple wrong login, A user tries to edit a task property which he is not allowed to change |
INFO | 8 | user entered wrong password, wanted exceptions BadMethodCall on known non existent methods (HEAD), other known and wanted exceptions |
DEBUG | 16 | debugging on a level also useful for SysAdmins, for example user logins |
TRACE | 32 | tracing debugging on a level only useful for developers |
...
Code Block |
---|
title | Current writer configuration in application.ini |
---|
linenumbers | true |
---|
|
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 |
---|
title | task 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 |
---|
language | php |
---|
title | In 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:
...