473,385 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Eventlog questions

hi there,

i am out of ideas what to do with that eventlog-things. it seems,
that the implementation of the eventlog-support in dotnet is really
poor. however, here are the problems i have at the moment:

- if i ask for the id of an event i do not get the number that is
displayed in the eventviewer for messages with replacement-strings.

- if i ask for the message of an event with replacement-strings, i get
the message with "unable to format message...".

does anyone of you have an idea of how to solve that problems?

i'd appreciate any help.

thanks,

crea

Nov 15 '05 #1
4 3309
"dd" <so*****@somewhere.com> schrieb im Newsbeitrag news:UO********************@news20.bellglobal.com. ..
I must see your code before answering.


hi dd,

here it comes:

public static void WriteEvents(string Machine, string Log, string DisplayFormat)
{
EventLog Reader=null;
Reader=new EventLog(Log, Machine);

foreach (EventLogEntry Entry in Reader.Entries)
{
Console.WriteLine("***");
Console.WriteLine("Type : " + Entry.EntryType.ToString());
Console.WriteLine("Date : " + Entry.TimeGenerated.ToShortDateString());
Console.WriteLine("Time : " + Entry.TimeGenerated.ToLongTimeString());
Console.WriteLine("Source : " + Entry.Source.ToString());
Console.WriteLine("Category : " + ((Entry.CategoryNumber==0)?"none":Entry.Category.T oString()));
Console.WriteLine("EventID : " + Entry.EventID.ToString());
Console.WriteLine("User : " + ((Entry.UserName==null)?"none":Entry.UserName.ToSt ring()));
Console.WriteLine("Machine : " + Entry.MachineName.ToString());
Console.WriteLine("Message : " + Entry.Message.ToString().Replace("\n", "-").Replace("\r", "-"));
}
}

nothing unusual, as you can see. its just querying the eventlog.

cheers,

crea

Nov 15 '05 #2
"dd" <so*****@somewhere.com> schrieb im Newsbeitrag news:UO********************@news20.bellglobal.com. ..
I must see your code before answering.


hi dd,

here it comes:

public static void WriteEvents(string Machine, string Log, string DisplayFormat)
{
EventLog Reader=null;
Reader=new EventLog(Log, Machine);

foreach (EventLogEntry Entry in Reader.Entries)
{
Console.WriteLine("***");
Console.WriteLine("Type : " + Entry.EntryType.ToString());
Console.WriteLine("Date : " + Entry.TimeGenerated.ToShortDateString());
Console.WriteLine("Time : " + Entry.TimeGenerated.ToLongTimeString());
Console.WriteLine("Source : " + Entry.Source.ToString());
Console.WriteLine("Category : " + ((Entry.CategoryNumber==0)?"none":Entry.Category.T oString()));
Console.WriteLine("EventID : " + Entry.EventID.ToString());
Console.WriteLine("User : " + ((Entry.UserName==null)?"none":Entry.UserName.ToSt ring()));
Console.WriteLine("Machine : " + Entry.MachineName.ToString());
Console.WriteLine("Message : " + Entry.Message.ToString().Replace("\n", "-").Replace("\r", "-"));
}
}

nothing unusual, as you can see. its just querying the eventlog.

cheers,

crea

Nov 15 '05 #3
dd
Maybe, I just did not understand your problem.
When I ran your code, it prints everything identical to my EventLog.
EventId's are the same as in the EventLog.
Did you get errors while running your code, or you are trying to accomplish
something else?

"Crea-Ue. Kirdar" <us****@creatorium.de> wrote in message
news:bg************@ID-57402.news.uni-berlin.de...
hi there,

i am out of ideas what to do with that eventlog-things. it seems,
that the implementation of the eventlog-support in dotnet is really
poor. however, here are the problems i have at the moment:

- if i ask for the id of an event i do not get the number that is
displayed in the eventviewer for messages with replacement-strings.

- if i ask for the message of an event with replacement-strings, i get
the message with "unable to format message...".

does anyone of you have an idea of how to solve that problems?

i'd appreciate any help.

thanks,

crea

Nov 15 '05 #4
dd
Maybe, I just did not understand your problem.
When I ran your code, it prints everything identical to my EventLog.
EventId's are the same as in the EventLog.
Did you get errors while running your code, or you are trying to accomplish
something else?

"Crea-Ue. Kirdar" <us****@creatorium.de> wrote in message
news:bg************@ID-57402.news.uni-berlin.de...
hi there,

i am out of ideas what to do with that eventlog-things. it seems,
that the implementation of the eventlog-support in dotnet is really
poor. however, here are the problems i have at the moment:

- if i ask for the id of an event i do not get the number that is
displayed in the eventviewer for messages with replacement-strings.

- if i ask for the message of an event with replacement-strings, i get
the message with "unable to format message...".

does anyone of you have an idea of how to solve that problems?

i'd appreciate any help.

thanks,

crea

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joe | last post by:
I am trying to read the EventLog of different servers on the network. If I run the script in a command line, it works well. But when I try to put the script into the Web server (IIS in Windows...
0
by: Crea-Ue. Kirdar | last post by:
hi there, i am out of ideas what to do with that eventlog-things. it seems, that the implementation of the eventlog-support in dotnet is really poor. however, here are the problems i have at the...
2
by: Next | last post by:
Hello all, I have a windows service that was suppose to write some events into its own EventLog. I created the EventLog using the component on VS 2003 toolbar Added an installer for it. Set...
1
by: MAL | last post by:
Hello, I am writing a service program that writes to a custom EventLog. I would like the two classes used in the service to write messages to the same log ideally using a different Source name...
1
by: martin | last post by:
Hi, I'm having some problems with the System.Diagnostics.EventLog class in .NET 2.0 I need to recreate an event message source inside a new log but the messages keeps ending up in the old...
3
by: Ben | last post by:
I am trying to write an eventlog monitor. I am using the sample code provided by VB2005 SDK as the bases for my application. I need to monitor all three logs (application, system, and security)....
0
by: rene | last post by:
I'm trying to use costome categories in my eventlog for a program I'm writing. But I have some problems with it, I cant get it to work. Checklist for how I did this. 1. Created a...
2
by: Zytan | last post by:
What's a Window event log? EventLog documentation basically assumes the reader knows what it is. It says the following: http://msdn2.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx...
1
by: Jeff | last post by:
hi ..Net 2.0 I've created the code below and think I've executed it. After I thought I've executed it I checked in EventLog on the computer (win2k3) and no entry was added. This could mean 2...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.