Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

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.

Subject: logger and app domains
Prev Next
You are not authorized to post a reply.

Author Messages
Graham Walsh

09/18/2008 3:50 PM  
Hi,
 
I have an issue with a GUI app I'm running. I make calls across dll's as expected and my logging works fine. I have a richTextappender in place thats used by the GUI. As logging is done I see it in the richText box of my gui. We'll call this "normal" execution.
 
Now as part of our testing, I create an appDomain and make the method calls just as does the "normal" execution. I want this new appdomain to log to the same richTextBox however its not. In an attempt to take another approach, I tried to get the ILog object from the "Normal" execution and set it in the newly created AppDomain. This cant be done as;
 
 

- System.Runtime.Serialization.SerializationException: Type 'log4net.Core.LogImpl' in Assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' is not marked as serializable.

 

So I'm stuck. Anybody know how I can work around this issue?

 

thanks much

 

Graham

 

 

 

 

Nick Durcholz

09/18/2008 7:04 PM  

Since you are logging accross app domains, you best option is to use the
remoting appender:

http://logging.apache.org/log4net/release/sdk/log4net.Appender.RemotingA
ppender.html

Peter Drier

09/20/2008 7:57 PM  
We're using log4net in an multi app domain application..  Lets say it was tricky..   Not sure if this would solve your problem, but this is what we did:

1.  In the root app domain, we setup log4net as normal..  And added a custom Plugin that we wrote to the l4n interface that was accessible to our child domains.
1..  In each child app domain, we setup l4n with a single custom appender that knew how to find the plugin from #1 and forward all events to it, after a few checks to ensure that exceptions were serializable.  

So now anything logged in the child domain was sent to the parent, to follow the config rules and get logged out as necessary.  

Cheers,
Peter

--
Peter's Photography
www.PeterDrier.com
Ron Grabowski

09/21/2008 7:51 PM  
My first thought would be to use .NET Remoting with named pipes. Did you try that?
 
Peter Drier

09/21/2008 11:27 PM  
Remoting to another process would have incurred a level of overhead we weren't willing to take for the logging portion of the application..  named pipes would have saved a bunch of the overhead, but I'm pretty sure the app domain crossing setup we came up with is about as optimal as we can get under the multi app domain setup we have..

-Peter

--
Peter's Photography
www.PeterDrier.com
You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > logger and app domains



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement