Caliburn.Micro
Caliburn.Micro copied to clipboard
Problem with replacing LogManager.GetLog
If I want to replace the logger of Caliburn.Micro I can register the function to resolve it to the
LogManager.GetLog static property.
However, this can be done only after finishing the configuration if the IoC is required (means the Bootstrapper's configuration needs to be finished).
If I step through with the Debugger I can see that the view is calling it too early. The following code snippet is from my Bootstrapper class that is derived from BootstrapperBase.

… ending up in a message that the IoC is not yet configured. How to replace the logger then? Where do the previous logging messages go? Somehow the View class of CM is calling the logger too early.
I guess, Logging should not start earlier than the finish of configuration, right?
Most of the loggers are defined as static properties which means they'll be created early but nothing will be logged.
I'm not sure of any easy way to change this other than moving all logs within the framework to Lazy or something equivalent.
Most of the loggers are defined as static properties which means they'll be created early but nothing will be logged.
I'm not sure of any easy way to change this other than moving all logs within the framework to
Lazyor something equivalent.
I mean there is a call to the static Logger before the Configure method was finished. I is like calling the IoC to resolve before it has been built. I don't know the logging framework before it can be resolved. Maybe not important, but the current implementation tries to log something to nirvana. Actually previous logger setting... but where would you expect to see that output?
Most of the loggers are defined as static properties which means they'll be created early but nothing will be logged.
That global static usage changed a bit with net core and generic host usage.