On Dec 9, 2010, at 1:39 PM, Martin Fetzel wrote:

> Yes it seems that i have to serialize the logger itself. The problem is
> that the new pluginmanager is using appdomains and the Ilog object
> should be serializeable. When in the Appdomain an instance of the plugin
> will be created an exception will be thrown.


LoggingEvent's are serializable, but serializing loggers isn't either practical 
or desirable.  If it were so, you'd be in essence storing the state of the 
entire hierarchy of loggers, appenders and such since only if you had the 
entire graph of objects would you really capture the state of a logger and then 
you'd need to be able to reestablish any open files, sockets, etc to get 
everything to an functionally equivalent state.

So, it appears that you have a serializable class that has a ILog instance 
member.  Your solution is to replace the ILog member with a static member or 
with something serializable (string for example) that can be used to reacquire 
the logger after deserialization.  If static isn't appropriate, the next 
simplest approach would be replace the ILog with a string containing the logger 
name and to call GetLogger() on demand to get a logger.   

Reply via email to