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 |
|
Jon Finley
 |
| 09/27/2005 6:21 PM |
|
Hi all,
I am using the MsmqAppender on the Full Framework without problems. Recently had to port it to the Compact Framework. Up until this point we have used Odyssey.CFCom to bridge the managed code to COM gap (since the Messaging namespace does not exist in the 1.0 CF) and that is what I used in the MsmqAppender. This works. However; there seems to be a memory leak. This has been a problem for us with CFCom (in other applications) that we have solved by instantiating the CFCom objects at application start and holding onto them until exit (not creating or re-creating them over and over).
I'm not exactly sure what I'm looking for here. Perhaps someone has a working Compact Framework MsmqAppender they would share?? If not, is there a link that explains the log4net lifecycle within an application? I had hoped that the Appender would be created once when the app starts but this does not appear to be the case (although I'm enough information to even state that). Another option might be a chunk of code that uses MSMQ thru the API (and avoid CFCom altogether).
All ideas appreciated. (Yes, I have even thought of using version 2.0 of the compact framework but thought I would do some more research before making that leap.)
Thanks!
Jon
|
|
|
|
|
Ron Grabowski
 |
| 09/27/2005 7:07 PM |
|
This post shows how to create a FilAppender at runtime:
http://tinyurl.com/9mv9f http://www.mail-archive.com/log4net-user%40logging.apache.org/msg02362.html
Once you've created the appender, you may need to use code like this to add the appender to the repository:
// RollingFileAppenderTest.cs _root = ((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
_root.AddAppender(appender); _root.Repository.Configured = true;
It should also be possible to iterate through configured appenders once the application has started and change their options.
|
|
|
|
|
Nicko Cadell
 |
| 09/28/2005 4:15 PM |
|
> I had hoped that > the Appender would be created once when the app starts but > this does not appear to be the case (although I'm enough > information to even state that).
Appenders are either created programmatically or by loading a config file. If loading from a config file the appender will be created, if referenced by a <root> or <logger> element in the same file. The appender will be closed when the application terminates. If the config APIs are used to reload a config file then the appender will be closed and a new appender created.
In most cases therefore the appender will be created a configure time and not closed until the application terminates.
Cheers, Nicko
|
|
|
|
|
Jon Finley
 |
| 09/28/2005 4:40 PM |
|
Thanks Nicko.
With a liberal sprinkling of debug output to the console I can confirm that I am seeing what you have described.
I think the memory leak is solved (or at least isn't as bad). I'm certainly not a CE expert but managed code to COM (using CFCom) on WinCE certainly appears to be a fragile thing.
Jon
|
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|