Hi,

I am using the Arsd cgi class (https://github.com/adamdruppe/arsd) to spawn an http server. Each http request is handled in its own thread. Is it safe to set in void main a FileLogger to which each thread will write to?

void main()
{
...
sharedLog = new FileLogger("New_Default_Log_File.log");
...start server...
}

void handleRequest(Cgi request)
{
    // is executed in own thread
    log("abc");
}

If this works, also another question. Each http request is identified by a unique id. It would be great if I could set per thread this value within the logger as custom tag.

The purpose is, whenever I log a message, this custom tag (The identifier of the http request) should be added to the log. I assume the current logger framework is not capable to do this?

Kind regards
André

Reply via email to