I am trying to handle an Enterprise Library 6 LogWriter Exception that has recently popped up after upgrading from Enterprise Library 4 to 6.
I either get:
The LogWriter has not been set for the Logger static class. Set it invoking the Logger.SetLogWriter method.
OR
The LogWriter is already set.
...depending on the scenario.
The problem is that it throws an InvalidOperationException
which seems too generic to handle, and that even checking using
if (Logger.Writer == null)
... also yields an exception, so how would one then check if the writer is set or not?