Wt: Configure the application's log at the runtime
Added by Hafiz Ahamd about 1 month ago
Hi, I know it's possible to configure an application's log using "* -debug" in the wt_config.xml file. But is there a way to configure the log at the runtime i.e. using WApplication or else?
Replies (3)
RE: Wt: Configure the application's log at the runtime - Added by Matthias Van Ceulebroeck 20 days ago
Hey Hafiz,
apologies for the delay, I was out sick for a little while, and then of course we had the holidays.
You can set the logging configuration with WLogger::configure(). But this is on the whole WServer
, not for each application. So I don't think Wt offers what you are looking for, i.e. logging specific endpoint/users separately.
You can always add some "identifier" to you logs to add context, and then parse logs, while taking this context into consideration.
Best,
Matthias
RE: Wt: Configure the application's log at the runtime - Added by Hafiz Ahamd 20 days ago
Hi Matthias, Thank you for the reply!
One more question, how can I access the WLogger in my WApplication class? I tried the following but it doesn't seem to work,
#include
...
Wt::logInstance().configure("* -debug -info");
...
Regards,
Hafiz
RE: Wt: Configure the application's log at the runtime - Added by Matthias Van Ceulebroeck 20 days ago
Hello Hafiz,
you can access it via the WServer
, calling WServer::logger().
As above, be aware that this is a global logger, and will thus affect any running application.
Best,
Matthias