qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: Need to customize logging in client application
Date Mon, 04 Oct 2010 13:56:54 GMT
On 10/04/2010 09:41 AM, Carl Trieloff wrote:
> On 10/01/2010 03:05 PM, shailesh wrote:
>> Hi Folks,
>>
>> [I am using the C++ API talking to a C++ qpid broker 0.6]
>>
>> My application that uses qpid, prints errors to stderr (for example, when a
>> connection to the qpid server fails),
>> and I'd like to control/customize where the output is sent to.
>>
>> I understand the use of environment variables (on the client) like
>> QPID_LOG_TO_FILE, QPID_LOG_SOURCE etc
>>
>> But I'd like to control this programmatically in my app, ideally by
>> overriding some class/member function and
>> instead redirect the log messages to use my application's existing logging
>> functions.
>>
>> If not, at least, I would like to suppress output to stderr, and instead
>> direct it to a specific file.
>>
>> Could someone point me to how I could go about doing this?
>>

To disable logging entirely:

#include <qpid/Logger.h>
qpid::log::Logger::instance().clear();

To send log messages to your own code, subclass qpidd::Log::Output and call 
Logger::output to register it.

I think you're the first independent implementer of a log output so shout if you 
find it awkward, if the doxygen needs clarifying etc.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message