The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.
| Author |
Messages |
|
Richard Collette
 |
| 08/03/2006 3:14 PM |
|
I implemented a custom LogManger to allow a couple additional levels. My concern going forward is that I will constantly have to determine what new code is not present in my LogManager vs. the standard Log4Net LogManager.
Insight?
Thanks,
Rich
|
|
|
|
|
Nicko Cadell
 |
| 08/03/2006 3:49 PM |
|
LogManager only contains static methods. If you could extend it you would still need to implement all the methods that return the ILog interface (use the new keyword). This doesn't help when new methods are added to the LogManager as you wouldn't be hiding it in your subclass so it would become unexpectedly available - your users might use it, but the behaviour would not be as expected, i.e. it would just be the same as calling the static method on the LogManager class.
A much better solution is to use generics (.NET 2.0 and Mono 2.0 only), to mean that you don't need to write a custom LogManager at all:
The calls to the LogManager would be something like:
ILog log = LogManager<ILog>.GetLogger("foo");
We can do something to keep backwards compatibility.
Then to define your own logger type you would just need to define a factory class and probably configure that using an attribute on your custom logger, then you could do:
CustomLog log = LogManager<CustomLog>.GetLogger("foo");
I haven't really work this through, but I think it should give a much nicer solution than copying the whole of the LogManager and renaming the return types.
Nicko
|
|
|
|
|
Richard Collette
 |
| 08/03/2006 8:19 PM |
|
I was thinking generics might help in this case too. But I don't think it will happen any time soon to keep backward compatibility.
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|