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

Ivan Habunek commented on LOG4PHP-166:
--------------------------------------

That shows why code review is important. :)
I have fixed it now. Have another look please.
                
> LoggerAppenderMongoDB should supply a timeout value to the Mongo() 
> constructor when it connects for the first time.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4PHP-166
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-166
>             Project: Log4php
>          Issue Type: Improvement
>          Components: Code
>    Affects Versions: 2.1, 2.2
>            Reporter: David Hilowitz
>            Assignee: Ivan Habunek
>            Priority: Minor
>             Fix For: 2.3
>
>         Attachments: patch_commit_59b06e94668f.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> It would be great if LoggerAppenderMongoDB could supply a timeout value to 
> the Mongo() constructor when it connects for the first time. 
> Here's why:  If something is wrong with the Mongo database server -- for 
> example, if the server is offline -- it often takes a really long time (10 or 
> more seconds) to fail and throw an exception.  This is terrible in a 
> situation where we need a quick turnaround time and are using the logger to 
> collect diagnostic data. 
> Ideally, a timeout value could be specified in the log4php config XML file 
> along with the host, name, etc. 
> I already have a patch that fixes this issue. The main gist of it is this. 
> Change this:
> $this->connection = new Mongo(sprintf('%s:%d', $this->host, $this->port));
> to this:
> $this->connection = new Mongo(sprintf('%s:%d', $this->host, $this->port), 
> array("timeout" => $this->timeout));
> Useful Resources:
> * PHP Docs that explain the Mongo() constructor timeout value: 
> http://php.net/manual/en/mongo.construct.php

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to