[CDRIVER-620] Runtime flag for TRACE Created: 21/Apr/15  Updated: 17/Aug/15  Resolved: 29/Jul/15

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.2-beta0

Type: Bug Priority: Major - P3
Reporter: Hannes Magnusson Assignee: Hannes Magnusson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-697 Turn on basic err checking in release... Closed
is related to PHPC-256 Production debug logs Closed

 Description   

I love the mongoc tracing, its a godsend.

During development of the PHP driver I always compile mongoc with -DMONGOC_TRACE and then at runtime in my log handler I check if I should print these things to stderr, file, or ignore it.

I am planning on shipping the driver with tracing enabled as I want to be able to get full debugging logs with a flip of a userland-switch (e.g. no need for the user to recompile anything or jump through hoops).

This works fine for all the other log events without any clear performance penalty (-ish, vargs and strdupv_printf()s...) – but in the tracing case, DUMP_BYTES() & DUMP_IOVEC() are painful.

It would be fantastic if we could short circuit the DUMP_*() madness, and out of mongoc_log() based on a "config setting".



 Comments   
Comment by Githook User [ 05/Aug/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-620 restore logger state after tests

Prevents a much-later crash in the test suite on win32.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/841bb4d8a914f9b2fd364cb13d67cc665c71a294

Comment by Hannes Magnusson [ 29/Jul/15 ]

We wound up with calling the functions:
mongoc_log_trace_enable () / mongoc_log_trace_disable ()

Comment by Githook User [ 29/Jul/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-620: Allowing explicit enabling/disabling of tracing

Tracing still needs to be compiled in!
When it is compiled in, you can turn it off/on by using
mongoc_log_trace_enable () / mongoc_log_trace_disable ()
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/2b8dca1eee6a780fbccb41978f302830109d7366

Comment by A. Jesse Jiryu Davis [ 13/Jul/15 ]

Should actually be "mongoc_trace_enable".

Comment by Hannes Magnusson [ 22/Apr/15 ]

C API – otherwise our users would have to restart their webserver cluster which isn't optimal.
kudos

Comment by A. Jesse Jiryu Davis [ 22/Apr/15 ]

OK, I'll try to get this in by 1.2 final. An environment variable like DISABLE_MONGOC_TRACE, or a C API like mongoc_enable_trace(bool)?

Comment by Hannes Magnusson [ 22/Apr/15 ]

jesse If you have the time it'd be appreciated - I fear I don't have the time before the 1.2 ship date.

Comment by A. Jesse Jiryu Davis [ 22/Apr/15 ]

Sounds good, would you like to do it or prefer I do?

Generated at Wed Feb 07 21:10:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.