Getting a lof of errors on PHP 5.4 coming from the mongo driver

128 views
Skip to first unread message

Marcin

unread,
Jul 16, 2012, 5:03:25 AM7/16/12
to mongod...@googlegroups.com
Hi!

My environment is:
  • Windows
  • PHP 5.4.3
  • Mongo driver 1.2.10
  • MongoDB 2.0.6

I am getting a lot of errors, which seem to be logging related, they appear as NOTICE errors, for example:

  • NOTICE: Mongo::__construct(): parsing servers
  • NOTICE: Mongo::__construct(): current: localhost
  • NOTICE: Mongo::__construct(): done parsing
  • NOTICE: Mongo::__construct(): localhost:27017: pool get (0x50889d8)
  • NOTICE: Mongo::__construct(): localhost:27017: found in pool (0x50889d8)
  • NOTICE: MongoCursor::getNext(): hearing something
  • NOTICE: MongoCursor::getNext(): saying something

They appear all at once each 2-3 page refreshes.

I think it started with PHP 5.4, any idea?

Thank you,
Marcin

Nat

unread,
Jul 16, 2012, 5:13:31 AM7/16/12
to mongod...@googlegroups.com
Mongodb driver logs certain operation with E_NOTICE level. If you don't want it to show up, make a call to error_reporting() function with proper logging level or set "error_reporting" in php.ini
From: Marcin <marci...@gmail.com>
Date: Mon, 16 Jul 2012 02:03:25 -0700 (PDT)
Subject: [mongodb-user] Getting a lof of errors on PHP 5.4 coming from the mongo driver
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Marcin Gil

unread,
Jul 16, 2012, 5:29:40 AM7/16/12
to mongod...@googlegroups.com
Hello,

I am afraid it is not a solution, hiding NOTICE error is for rookies to say at least.

Cheers mate

2012/7/16 Nat <nat....@gmail.com>

Sam Millman

unread,
Jul 16, 2012, 5:38:57 AM7/16/12
to mongod...@googlegroups.com
"rookies"?

NOTICE errors are not actually errors. They are actually log positions within PHP so why try to fix something that's not broken and is actually desired behaviour within PHP?

You don't want it in your log then turn it off...

I mean fair enough maybe the Mongo driver should have it own debug setting which allows you to choose whether or not a log gets written, but still...rookies??

Marcin Gil

unread,
Jul 16, 2012, 5:52:24 AM7/16/12
to mongod...@googlegroups.com
I cannot agree with you, how would you feel having 100 notice errors on each page refresh? I cannot even see how the website looks right now.
MongoDB driver should not report any NOTICE's since they have no value or meaning - in opposite to NOTICE errors coming from PHP (for example usage of non existing variable)
If you fail to see this as error I am afraid I have nothing to discuss with you.

This problem seems to be very common these days, there are lots of topics on stackoverlow/twitter about it, but no answers.
It never happend before.


2012/7/16 Sam Millman <sam.m...@gmail.com>

Alessandro Pellizzari

unread,
Jul 16, 2012, 6:03:50 AM7/16/12
to mongod...@googlegroups.com
Il Mon, 16 Jul 2012 11:52:24 +0200, Marcin Gil ha scritto:

> I cannot agree with you, how would you feel having 100 notice errors on
> each page refresh? I cannot even see how the website looks right now.
> MongoDB driver should not report any NOTICE's since they have no value
> or meaning - in opposite to NOTICE errors coming from PHP (for example
> usage of non existing variable)

Maybe the mongo driver has been compiled with DEBUG on.

You should ask the maintainer or recompile it yourself and disable
debugging messages.

Bye.


Sam Millman

unread,
Jul 16, 2012, 6:15:54 AM7/16/12
to mongod...@googlegroups.com
Yea you prolly tried to install it manually like so:

http://php.net/manual/en/mongo.trouble.php

You might also be using:

http://www.php.net/manual/en/class.mongolog.php

Of course if your using MongoLog then you should comment out that code since the Mongo driver is producing log that you asked for.

Sam Millman

unread,
Jul 16, 2012, 6:26:32 AM7/16/12
to mongod...@googlegroups.com
If it was just a couple of lines liike you pasted then I would of said you were nip picking but if it's a "100 notice errors" then it sounds like the debug flag.

Marcin Gil

unread,
Jul 16, 2012, 6:28:04 AM7/16/12
to mongod...@googlegroups.com
I am using the driver from:
https://github.com/mongodb/mongo-php-driver/downloads
Which is official 10gen repo.

I am not using MongoLog nor I am enabling any debug.

I will report it to the bugtracker. Thanks.


2012/7/16 Sam Millman <sam.m...@gmail.com>

Marcin Gil

unread,
Jul 16, 2012, 6:29:18 AM7/16/12
to mongod...@googlegroups.com
Unfortunately the messages appear at random cases and in great quantities (100 or so), I did not turn any debug on, just updated the driver for PHP 5.4.

2012/7/16 Sam Millman <sam.m...@gmail.com>

Sam Millman

unread,
Jul 16, 2012, 6:34:25 AM7/16/12
to mongod...@googlegroups.com
Does it happen with 1.2.5? If not there is prolly a config setting change and DEBUG has accidently been compiled by default.

Marcin Gil

unread,
Jul 16, 2012, 6:37:18 AM7/16/12
to mongod...@googlegroups.com
Hi Sam, no it does not. It is just 1.2.10.

2012/7/16 Sam Millman <sam.m...@gmail.com>

Sam Millman

unread,
Jul 16, 2012, 6:40:49 AM7/16/12
to mongod...@googlegroups.com
Yea I reckon it's been compiled with DEBUG.

Lets leave this thread open for the mantainer.

Marcin Gil

unread,
Jul 16, 2012, 6:43:58 AM7/16/12
to mongod...@googlegroups.com
Thanks for the investigation and your time.
I am sorry for my rough words, but I really do not prefer hiding errors over fixing them.

2012/7/16 Sam Millman <sam.m...@gmail.com>

Sam Millman

unread,
Jul 16, 2012, 6:49:49 AM7/16/12
to mongod...@googlegroups.com
Ah I was kinda rough too. I guess I've been in too many "Is E_NOTICE really an error?" convos :P so I'm sorry too :).

But yea hopefully 10gen should be here in a couple of hours and they can recompile with the right flags.

Marcin Gil

unread,
Jul 16, 2012, 6:53:01 AM7/16/12
to mongod...@googlegroups.com
I can understand that, thanks again mate.

2012/7/16 Sam Millman <sam.m...@gmail.com>

Nat

unread,
Jul 16, 2012, 7:21:57 AM7/16/12
to mongod...@googlegroups.com
By default, php standard installation will have the logging level set as E_ALL except E_NOTICE. However, if you need to turn E_NOTICE on, you can call MongoLog::setLevel to be higher so that it won't log too much info.

http://php.net/manual/en/mongolog.setlevel.php
From: Marcin Gil <marci...@gmail.com>
Date: Mon, 16 Jul 2012 12:53:01 +0200
Subject: Re: [mongodb-user] Re: Getting a lof of errors on PHP 5.4 coming from the mongo driver

Marcin Gil

unread,
Jul 16, 2012, 7:38:22 AM7/16/12
to mongod...@googlegroups.com
MongoLog is turned OFF by default, I am not using it, hence there should be no notices displayed.

2012/7/16 Nat <nat....@gmail.com>

Derick Rethans

unread,
Jul 16, 2012, 9:00:27 AM7/16/12
to mongod...@googlegroups.com
On Mon, 16 Jul 2012, Sam Millman wrote:

> "rookies"?
>
> NOTICE errors are not actually errors. They are actually log positions
> within PHP so why try to fix something that's not broken and is actually
> desired behaviour within PHP?

Uh, Marcil is right and you should (for various reasons) try not to have
notices in your code. Turning them off is not a good idea most of the
time.

cheers,
Derick

--
http://mongodb.org | http://derickrethans.nl
twitter: @derickr and @mongodb
Reply all
Reply to author
Forward
0 new messages