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 James Green <Ja...@occam-dm.com> on 2009/06/19 16:24:14 UTC

EventLog Fun Continued.

Hi All,
 
I'm still at a total loss as to how to get log4net successfully writing
to a custom event log, writing to the Application event log is working
exactly as expected.
 
I have started using the IEventIDLog extension in order to pass over
event IDs to the log messages to see if this makes any difference.
 
I've looked over google a lot over the last couple of days and have
tried everything I have found in terms of suggestions.  The most recent
one being this:
 
http://www.mail-archive.com/log4net-user@logging.apache.org/msg02396.htm
l
 
Which talks of the same error I'm seeing in the application log that I
mentioned before:

I try to write to MyLog and this is entered into the Application log:

The description for Event ID ( 0 ) in Source ( MyFirstApp ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. You may be able to use the /AUXSOURCE= flag to retrieve this
description; see Help and Support for details. The following information
is part of the event: 2009-06-19 12:11:27,234 14 INFO <MachineName>
<username> Logging.TestHarness.vshost.exe (line: 220)
Logging.TestHarness.LogEntryCreator - Message number 71
System.Exception

I think tried this suggestion:

            ILog logger = LogManager.GetLogger(sender);
            log4net.ThreadContext.Properties["EventID"] = 12;
            logger.Info(0,message);

Which didn't make any difference.  I have checked over the Sources key
entries being created in the registery and all seems to be correct in
there as well.  I just never see *anything* making it into the MyLog
event log.

I've probably got another 2 hours left to use on this before I have to
move onto other work which is incredibly frustrating as I will leave
behind a 'buggy' half finished wrapper.

Any input would be much appreciated.

:|

James

SV: unsubscribe

Posted by Dag Christensen <Da...@vismaretail.no>.
The instructions on log4net's project page didn't work?

http://logging.apache.org/log4net/mail-lists.html


-----Opprinnelig melding-----
Fra: Monica Vezzalini [mailto:mvezzalini@eim.it] 
Sendt: 22. juni 2009 09:19
Til: 'Log4NET User'
Emne: R: unsubscribe

Hello I have been trying to unsuscribe as well without success. Does anybody
know the right address to which one should send unsubscription requests?
Thank you

Monica Vezzalini
________________________________

Eurosoft Informatica Medica S.r.l.
Via Giardini 468/A, 41100 Modena - Italy
Telefono: +39 059 347711
Fax: +39 059 344899
Email: mvezzalini@eim.it
-----Messaggio originale-----
Da: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Inviato: venerdì 19 giugno 2009 22.45
A: Log4NET User
Oggetto: Re: unsubscribe


I think you need to send an email to a special unsubscribe address, not just
a subject with unsubscribe as the subject.



----- Original Message ----
From: Laurence Hunter <ca...@yahoo.com>
To: Log4NET User <lo...@logging.apache.org>
Sent: Friday, June 19, 2009 12:51:17 PM
Subject: unsubscribe


unsubscribe


###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/

R: unsubscribe

Posted by Monica Vezzalini <mv...@eim.it>.
Hello I have been trying to unsuscribe as well without success. Does anybody
know the right address to which one should send unsubscription requests?
Thank you

Monica Vezzalini
________________________________

Eurosoft Informatica Medica S.r.l.
Via Giardini 468/A, 41100 Modena - Italy
Telefono: +39 059 347711
Fax: +39 059 344899
Email: mvezzalini@eim.it
-----Messaggio originale-----
Da: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Inviato: venerdì 19 giugno 2009 22.45
A: Log4NET User
Oggetto: Re: unsubscribe


I think you need to send an email to a special unsubscribe address, not just
a subject with unsubscribe as the subject.



----- Original Message ----
From: Laurence Hunter <ca...@yahoo.com>
To: Log4NET User <lo...@logging.apache.org>
Sent: Friday, June 19, 2009 12:51:17 PM
Subject: unsubscribe


unsubscribe



Re: unsubscribe

Posted by Ron Grabowski <ro...@yahoo.com>.
I think you need to send an email to a special unsubscribe address, not just a subject with unsubscribe as the subject.



----- Original Message ----
From: Laurence Hunter <ca...@yahoo.com>
To: Log4NET User <lo...@logging.apache.org>
Sent: Friday, June 19, 2009 12:51:17 PM
Subject: unsubscribe


unsubscribe

unsubscribe

Posted by Laurence Hunter <ca...@yahoo.com>.
unsubscribe


      

Re: EventLog Fun Continued.

Posted by Ron Grabowski <ro...@yahoo.com>.
This code creates and writes to the appropriate custom event log area when I'm logged on as an Administrator on a Windows XP box stepping through a ConsoleApplication project in VS2008:

class Program
{
    private static EventLogAppender _eventLogAppender;

    static void Main(string[] args)
    {
        LogLog.InternalDebugging = true;
        LogLog.EmitInternalMessages = true;

        ConfigureEventLogAppender("ApplicationName", "LogName");

        ILog log = LogManager.GetLogger(typeof(Program));

        // first entry: normal case
        log.Debug("Hello World");

        // second entry: also write an EventID
        var loggingEvent = new LoggingEvent(
            typeof(Program), 
            log.Logger.Repository, 
            log.Logger.Name, 
            Level.Debug, 
            "Hello World With EventId", 
            null);
        loggingEvent .Properties["EventID"] = 42;
        log.Logger.Log(loggingEvent );
    }

    public static void ConfigureEventLogAppender(string appName, string logName)
    {
        _eventLogAppender = new EventLogAppender();
        _eventLogAppender.ApplicationName = appName;
        _eventLogAppender.Layout = new SimpleLayout();
        _eventLogAppender.LogName = logName;
        _eventLogAppender.Threshold = Level.All;
        _eventLogAppender.ActivateOptions();
        BasicConfigurator.Configure(_eventLogAppender);
    }
}

Note the casing of "EventID" and that its being attached to LoggingEvent's Properties bag and not to the more general ThreadContext.



----- Original Message ----
From: James Green <Ja...@occam-dm.com>
To: Log4NET User <lo...@logging.apache.org>
Sent: Friday, June 19, 2009 10:24:14 AM
Subject: EventLog Fun Continued.

Hi All,

I'm still at a total loss as to how to get log4net successfully writing
to a custom event log, writing to the Application event log is working
exactly as expected.

I have started using the IEventIDLog extension in order to pass over
event IDs to the log messages to see if this makes any difference.

I've looked over google a lot over the last couple of days and have
tried everything I have found in terms of suggestions.  The most recent
one being this:

http://www.mail-archive.com/log4net-user@logging.apache.org/msg02396.htm
l

Which talks of the same error I'm seeing in the application log that I
mentioned before:

I try to write to MyLog and this is entered into the Application log:

The description for Event ID ( 0 ) in Source ( MyFirstApp ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. You may be able to use the /AUXSOURCE= flag to retrieve this
description; see Help and Support for details. The following information
is part of the event: 2009-06-19 12:11:27,234 14 INFO <MachineName>
<username> Logging.TestHarness.vshost.exe (line: 220)
Logging.TestHarness.LogEntryCreator - Message number 71
System.Exception

I think tried this suggestion:

            ILog logger = LogManager.GetLogger(sender);
            log4net.ThreadContext.Properties["EventID"] = 12;
            logger.Info(0,message);

Which didn't make any difference.  I have checked over the Sources key
entries being created in the registery and all seems to be correct in
there as well.  I just never see *anything* making it into the MyLog
event log.

I've probably got another 2 hours left to use on this before I have to
move onto other work which is incredibly frustrating as I will leave
behind a 'buggy' half finished wrapper.

Any input would be much appreciated.

:|

James