Project

General

Profile

Integrating Boost.Log with Wt's WLogger

Added by Marco Craveiro over 4 years ago

Hi Wt developers and community,

many thanks for an excellent framework. I have a question regarding how the logging works in Wt. Apologies in advance if this has been asked before, but my google-fu didn't reveal any obvious matches.

I have an app that uses Boost.Log extensively for logging. Given that I am deploying into a cloud provider, I would like to output the logging to stdout so that I can use their logging management tools. However, I also like to see the logging coming out of Wt in stdout as it has a lot of important information. To do so I need to find some kind of way to wire WTLogger and Boost.Log. Is this possible? Basically, I need some kind of way of receiving calls to log and to execute my own logging code rather than Wt's default logging code.

Many thanks for your time.

Marco


Replies (2)

RE: Integrating Boost.Log with Wt's WLogger - Added by Roel Standaert over 4 years ago

Hi Marco,

At the moment it is not possible to directly send WLogger's output to another logger. I agree that that should be possible.

You can configure the stream that the logger logs to, though, so you can send the output to another ostream.

You can obtain the logger for a WServer with logger(), and use setStream() to send it to some other stream.

You can do this right after WServer was created and configured, but before you start it.

That does not configure wthttp's access logger, though. That one will log to stderr or can be set to a file.

I can see that there's some log4cplus code in WLogger.h, but I'm not sure if that was ever used.

I made an issue for this: https://redmine.emweb.be/issues/7240

Regards,

Roel

RE: Integrating Boost.Log with Wt's WLogger - Added by Marco Craveiro over 4 years ago

Thanks a lot for your prompt response. For now I will redirect wthttp's access log to file. When the issue is addressed I will try to pass the Boost.Log stream and see if that works...

Cheers

    (1-2/2)