You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Ivan Habunek (JIRA)" <ji...@apache.org> on 2011/06/19 23:15:47 UTC

[jira] [Commented] (LOG4PHP-110) mongo database appender for log4php

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

Ivan Habunek commented on LOG4PHP-110:
--------------------------------------

Hi Vladimir,

Sorry for the slow progress of this issue, but we have been busy trying to push the 2.1 release. We appreciate the work you put into this, but there is very few of us working on log4php at the moment.

I have seen your solution on github and I have taken most of the code from it. However, I think it has several issues.

Firstly, there are two appenders which are almost identical. LoggerAppenderMongoDBLayout and LoggerAppenderMongoDB. I understand what they do, but it seems unnecessary.

Secondly, the performance of LoggerAppenderMongoDBLayout is not optimal. When using it in combination with LoggerLayoutBson, the following happens:
	- LoggerLoggingEventBsonifier converts the event to an array
	- LoggerLayoutBson converts this array to json (includes converting the MongoDate object to timestamp)
	- LoggerAppenderMongoDBLayout converts the json back into an array (includes converting the timestamp back to MongoDate)
	
The event is first converted to an array, then to json, then back to an array before it is finally logged. You will agree that this is not the best solution.

I think the best approach to this problem is to have one appender: LoggerAppenderMongoDB which does not use a layout (because layouts produce strings, and here we need an array). This appender can have a protected method which converts the logging event to an array (taken from LoggerLoggingEventBsonifier). If a user wishes to modify the format of the logged array, they can simply extend LoggerAppenderMongoDB and override that method.

I have created and commited the following changes to the repository:
* Moved the conversion code from LoggerLoggingEventBsonifier to LoggerAppenderMongoDB::format()
* Removed the LoggerLoggingEventBsonifier
* Merged the tests from LoggerLoggingEventBsonifierTest into LoggerAppenderMongoDBTest

I would appreciate if you would review them and see if this meets all your requirements.

Best regards,
Ivan


> 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.2
>
>         Attachments: src.tgz, throwable.path
>
>
> mongo database appender for log4php with unit test coverage

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira