Why can't the source for a log have the service's name?!

  • Thread starter Thread starter K Viltersten
  • Start date Start date
K

K Viltersten

I noticed that then i execute the
following code everything works fine.

if (!EventLog.SourceExists(source))
EventLog.CreateEventSource(source, LOG_NAME);
EventLog eventLog = new EventLog(LOG_NAME);
eventLog.Source = source;
eventLog.WriteEntry(message, type);

But, to my astonishment, when i specify
the source to be of the same name as the
service (not LOG_NAME, but the service's
name), i get no logging. What's up here?!
 
I noticed that then i execute the
following code everything works fine.

if (!EventLog.SourceExists(source))
EventLog.CreateEventSource(source, LOG_NAME);
EventLog eventLog = new EventLog(LOG_NAME);
eventLog.Source = source;
eventLog.WriteEntry(message, type);

But, to my astonishment, when i specify
the source to be of the same name as the
service (not LOG_NAME, but the service's
name), i get no logging. What's up here?!

In fact, when i changed the name of the
service i still got the behavior, so the
only string that is equal to the name of
the source i'm trying to log is the
namespace name... I believe i'm getting
slightly retarded.
 
I noticed that then i execute the
following code everything works fine.

if (!EventLog.SourceExists(source))
  EventLog.CreateEventSource(source, LOG_NAME);
EventLog eventLog = new EventLog(LOG_NAME);
eventLog.Source = source;
eventLog.WriteEntry(message, type);

But, to my astonishment, when i specify
the source to be of the same name as the
service (not LOG_NAME, but the service's
name), i get no logging. What's up here?!

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.

I do not understand your question, do you get any entry at all in the
log?
If you are running Vista check the custom logs folder
 
I noticed that then i execute the
I do not understand your question, do you get
any entry at all in the log?

I don't blame you. It's a very strange thing.
Apparently, i made some registrations within
the registry that locked logging to the old
log. When i tried to log to the new one, i got
nothing. I got the hint to restart the computer
(or do some heavy duty registry digging) and it
"solved" the problem.

It's ennoying because i don't know what might
have caused it... Nevermind, for now, though.
Thanks for trying! :)
 
Back
Top