Is std.experimental.logger FileLogger thread safe?

Andre Pany andre at
Mon Feb 25 19:13:21 UTC 2019


I am using the Arsd cgi class 
( 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

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

More information about the Digitalmars-d-learn mailing list