[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] How to get debug output



On Tue, Oct 12, 2010 at 11:50 AM, Ralph Castain <rhc@xxxxxxxxxxxx> wrote:
>
> On Oct 12, 2010, at 8:59 AM, Nick Mathewson wrote:
>
>> On Tue, Oct 12, 2010 at 10:55 AM, Ralph Castain <rhc@xxxxxxxxxxxx> wrote:
>>> Hi folks
>>>
>>> I apologize for the ignorance - I'm sure this is something simple that I'm overlooking.
>>>
>>> I built libevent 2.0.7rc with the default configuration, so I did -not- specify --disable-debug. It is my understanding that the debug code is therefore built. I have confirmed that this is the case.
>>>
>>> I then have my code call event_enable_debug_mode prior to calling event_init. However, I never get any debug output sent to my screen, even though I confirmed that I am calling event_assign, event_add, and other libevent functions.
>>>
>>> Any suggestions on what I'm doing wrong?
>>> Ralph
>>
>> There are two debugging features here: event debugging mode, and the
>> verbose debug logs you're talking about.  Debug mode is a feature for
>> debugging your program; it turns on checks for incorrect uses of
>> events.  To get debugging output sent to stdout, rebuild with
>> "-DUSE_DEBUG" in the CPPFLAGS.
>
> Ouch - ick. It comes out all the time now.
>
> I gather that you only have a compile-time flag to toggle this output? I was hoping for a run-time option. Otherwise, we have to rebuild the system every time we want to debug something, which is an annoyance.

I'm afraid there isn't a run-time option for this.  If somebody wants
to submit a patch to write one, and you can do it efficiently, I'd be
glad to take it in the 2.1 series.

For now, could you build two copies of libevent -- one with debugging
logs and one without -- and use LD_PRELOAD (or another appropriate
linker option, depending on your platform) to switch in the debugging
one when you want to use it?  It's not beautiful, but it should work
out okay for most applications.

-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.