logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Billy Barnum" <b.bar...@comcast.net>
Subject (small) Registry Garbage Coliection Issue With EventLogAppender?
Date Fri, 23 Sep 2005 19:42:23 GMT
This is not a bug exactly . more like a garbage collection issue I notice
that has to do with EventLogAppender. And it's certainly a small issue, but
.

I notice that when I execute EventLogAppender with a security account that
doesn't have enough authority to set up its own EventSource in the EventLog,
log4net creates its own event sources in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application,
which is what you have to do if you want anything in the Source field for
your EventLog items. Very normal. A question and a comment about this,
though:

1. I notice that if the appdomain name or pgm name or whatever, is different
for every run of the program, a new registry key is created. This seems to
be the case when running a web site within Visual Studio. So I'm
accumulating quite a few registry entries. So my question is, "why not just
use a constant value each time so you don't keep adding registry keys
forever, or will production web sites in release mode have the same value
each time"? If production web sites also have different "names" each time
they start, I'll bet there are lot of registries out there accumulating a
lot of junk. Anyone know if this is the case?
2. The FAQ entry, "Why doesn't the EventLogAppender work?" talks to this
issue a bit, and mentions 2 methods for allowing your app to have write
authority and have its own 'Source' field. But there is a 3rd, registry-hack
method for those of you who didn't know (And I didn't until just now) and
don't want to create an EventLogInstaller, but just write to the Application
Log. See http://support.microsoft.com/default.aspx?scid=kb;en-us;329291 ,
and add <applicationName value="myEventSource" /> to your EventLogAppender
description in your config file. One thing the article doesn't mention,
though: after you create the key, you have to add a string value to it with
the name ' EventMessageFile' and an actual value of '
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\EventLogMessages.dll', or
current version of that assembly. Look at some of the other keys in the
vicinity for examples.

I found this last one out myself the hard way and post it to save other
newbies like me some time.

-BillyB

WILLIAM BARNUM
b.barnum@comcast.net
 



Mime
View raw message