[ 
https://issues.apache.org/jira/browse/LOG4PHP-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878634#action_12878634
 ] 

Vladimir Gorej commented on LOG4PHP-110:
----------------------------------------

Thanks for the info Christian.

Ok now the tricky part: 

1. $renderer = 
$this->logger->getHierarchy()->getRendererMap()->getByClassName(get_class($this->throwable));
2. if ($renderer instanceof LoggerRendererDefault) {
3.    $renderer = new LoggerRendererException();
4. } 

I aggree that this 4 lines of code are kind a tricky...I wanted to implement a 
little hack for the users to supply custom renderers for custom
exceptions. Use case example:

Let us say we have this exception: class DaoException extends Exception { } 

Clinet of log4php api wants to render DaoException in other way that every 
other Exception.
He implements and assigns DaoExceptionRenderer to the renderer map

First line of code   - we try to find custom exception renderer for current 
throwable context 
Second/Third line - if custom exception renderer doesn't exist and the rederer 
map returns default object renderer then render DaoException as standard 
exception (LoggerRendererException)
                                 - if it exists, render DaoException with 
custom exception renderer (DaoExceptionRenderer)

I hope it is clear now, what I itended to do.


> mongo database appender for log4php
> -----------------------------------
>
>                 Key: LOG4PHP-110
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-110
>             Project: Log4php
>          Issue Type: New Feature
>          Components: Code, Documentation, Tests
>    Affects Versions: 2.0
>         Environment: PHP
>            Reporter: Vladimir Gorej
>            Assignee: Christian Grobmeier
>             Fix For: 2.1
>
>         Attachments: src.tgz, throwable.path
>
>
> mongo database appender for log4php with unit test coverage

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to