You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Jon Finley <jd...@gksys.com> on 2005/09/27 18:21:52 UTC

Compact Framework 1.0 MsmqAppender

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
 
 
 

Re: Compact Framework 1.0 MsmqAppender

Posted by Ron Grabowski <ro...@yahoo.com>.
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.

--- Jon Finley <jd...@gksys.com> wrote:

> 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
>  
>  
>  
>