I've been writing logging code for our product, and have an architectural problem. We have two command-line executables, written in C++ for Window, call them Foo and Bar, that depend on a DLL which we'll name Core. I want to log from within Core.
The question is, where should those log entries end up? If I run Foo, I want to see them in Foo.log, and if I run Bar, they should be in Bar.log. What if I run both Foo and Bar at the same time, what then? (I think I already sorted the case when multiple copies of Foo or Bar are run, effectively locking the log file).
One thought is that Core can keep a list of "all the loggers I need to invoke when someone makes a logging request". This implies there is a whole new API to write and that logging in DLLs is written different to logging in exes or static libraries. That's not ideal. I may not even know where the code ends up if it's in a lib!
I've looked at log4cplus, and boost logging but can't get any traction on how this would work with those components either, so am a bit stuck for ideas. This is surely a solved problem though?!