logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ganapatiraju, Shiva \(OCFS\)" <Shiva.Ganapatir...@ocfs.state.ny.us>
Subject RE: How to log EventID with EventLogAppender?
Date Fri, 23 Sep 2005 21:25:24 GMT
Even  after 
log4net.ThreadContext.Properties("EventId") = 5
            log4net.ThreadContext.Stacks("EventId").Push("5")
            log.Error("Error Login Page.", ex)

I am getting this error.



The description for Event ID ( 0 ) in Source ( SSOPWebError ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. The following information is part of the event:  

Any suggestions are greatly appreciated


Shiva Ganapatiraju

New York State

Office of Children & Family Services

Information Technology/SSOP Project

518.403.9056

AD0149@dfa.state.ny.us

http://ocfs.state.nyenet/admin/ofm/rsu



--------------------------------------------------------
This communication, together with any attachments hereto or links contained herein, is for
the sole use of the intended recipient(s) and may contain information that is confidential,
privileged, or legally protected, and as such is not a public document.  If you are not the
intended recipient, you are hereby notified that any review, disclosure, copying, dissemination,
distribution or use of this communication is STRICTLY PROHIBITED. If you have received this
communication in error, please notify the sender immediately by return e-mail message and
delete the original and all copies of the communication, along with any attachments hereto
or links herein, from your system. 

-----Original Message-----

From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Friday, September 23, 2005 4:43 PM
To: Log4NET User
Subject: RE: How to log EventID with EventLogAppender?

The extension folder name may be misleading. The implementation isn't
very complex:

public void Info(int eventId, object message, System.Exception t) {  if
(this.IsInfoEnabled)  {
  LoggingEvent loggingEvent =  new LoggingEvent(...);
  loggingEvent.Properties["EventID"] = eventId;
  Logger.Log(loggingEvent);
 }
}

You could do basically the same thing using the normal ILog interface:

log4net.ThreadContext.Properties["EventId"] = 5; log.Info("Hello
World");
	
using(log4net.ThreadContext.Stacks["EventId"].Push("5"))
{
 log.Info("Hello World");
}

How do you propose this functionality be made part of the core? Do you
think the ILog interface members should be modified to accept a single
integer parameter? What if someone's EventId is a float, GUID, or a
string?

--- Billy Barnum <b.barnum@comcast.net> wrote:

> Ah, an extension. I was hoping to avoid that. You'd think that'd be 
> part of the core. Nevermind, though. I'll check it out - and thank you

> very much.
> 
> 
> 
> WILLIAM BARNUM
> b.barnum@comcast.net
>  
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:rongrabowski@yahoo.com]
> Sent: Friday, September 23, 2005 1:04 PM
> To: Log4NET User
> Subject: Re: How to log EventID with EventLogAppender?
> 
> Do you want to do something like this:
> 
>  public interface IEventIDLog : ILog
>  {
>   void Info(int eventId, object message);
>   void Info(int eventId, object message, Exception t);
>   void Warn(int eventId, object message);
>   void Warn(int eventId, object message, Exception t);
>   void Error(int eventId, object message);
>   void Error(int eventId, object message, Exception t);
>   void Fatal(int eventId, object message);
>   void Fatal(int eventId, object message, Exception t);  }
> 
> If so, there is example code here:
> 
> 
> http://cvs.apache.org/viewcvs.cgi/logging-log4net/extensions/net/1.0/
> 
> That works with both 1.0 and 1.1 of the Framework.
> 
> --- Billy Barnum <b.barnum@comcast.net> wrote:
> 
> > I'm logging with EventLogAppender, and setting the EventSource
> field
> > in the
> > Application Log using ApplicationName property. 
> > 
> > But I would like to log my own EventIds as well. Is there a way to
> do
> > this
> > with log4net? I'm not talking about putting something in the
> message
> > text,
> > but setting the actual eventID field in the log. I can't see a way.
> > What am
> > I missing?
> > 
> > 
> > WILLIAM BARNUM
> > b.barnum@comcast.net
> >  
> > 
> > 
> > 
> 
>

Mime
View raw message