473,383 Members | 1,925 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,383 software developers and data experts.

Setting category / event ID when tracing in VS2008

I am using an EventTraceListener to display certain significant events in a
VS2008 console app that runs on a server. I am able to write
"Trace.TraceError" messages, as well as information and warning messages,
along with my message text.

However, I cannot figure out how to the category and event ID, for display
in Event Viewer. Currently category = none, Event_ID = 0.

Jan 23 '08 #1
3 2362
Hi Tommy,

To learn how to specify category for the event log entry, we need to first
learn some background on how event log works. I will leave the details to
MSDN (http://msdn2.microsoft.com/en-us/lib...2(VS.85).aspx). Some
key quoted content:

Message Files (Windows)
(http://msdn2.microsoft.com/en-us/library/aa363669.aspx)
<blockquote>
Each event source should register message files that contain description
strings for each event identifier, event category, and parameter. Register
these files in the EventMessageFile, CategoryMessageFile, and
ParameterMessageFile registry values for the event source.
</blockquote>

Here our focus is on the CategoryMessageFile, which is a message text file
(http://msdn2.microsoft.com/en-us/lib...46(VS.85).aspx) to define
our category. For example, save following content (including the 4th line
with only a dot) in a file (for example: cats.mc):

MessageId=0x1
Language=English
MyCategory1
Jan 24 '08 #2
Hi Tommy,

I just found out that my last reply was truncated, sorry about that. Here's
the complete reply:

To learn how to specify category for the event log entry, we need to first
learn some background on how event log works. I will leave the details to
MSDN (http://msdn2.microsoft.com/en-us/lib...2(VS.85).aspx). Some
key quoted content:

Message Files (Windows)
(http://msdn2.microsoft.com/en-us/library/aa363669.aspx)
<blockquote>
Each event source should register message files that contain description
strings for each event identifier, event category, and parameter. Register
these files in the EventMessageFile, CategoryMessageFile, and
ParameterMessageFile registry values for the event source.
</blockquote>

Here our focus is on the CategoryMessageFile, which is a message text file
(http://msdn2.microsoft.com/en-us/lib...46(VS.85).aspx) to define
our category. For example, save following content (including the 4th line
with only a dot) in a file (for example: cats.mc):

MessageId=0x1
Language=English
MyCategory1
Jan 28 '08 #3
I understand now.

I was thinking that I could specify the category prior to, or concurrent
with, raising the Trace event.

I see from the referenced article that the category is looked-up from a
message file provided by the developer, which certainly makes sense, and also
allows for alternate language support.

Case closed!

(albeit with some more up-front work on the developer's part)

""Walter Wang [MSFT]"" wrote:
Hi Tommy,

I just found out that my last reply was truncated, sorry about that. Here's
the complete reply:

To learn how to specify category for the event log entry, we need to first
learn some background on how event log works. I will leave the details to
MSDN (http://msdn2.microsoft.com/en-us/lib...2(VS.85).aspx). Some
key quoted content:

Message Files (Windows)
(http://msdn2.microsoft.com/en-us/library/aa363669.aspx)
<blockquote>
Each event source should register message files that contain description
strings for each event identifier, event category, and parameter. Register
these files in the EventMessageFile, CategoryMessageFile, and
ParameterMessageFile registry values for the event source.
</blockquote>

Here our focus is on the CategoryMessageFile, which is a message text file
(http://msdn2.microsoft.com/en-us/lib...46(VS.85).aspx) to define
our category. For example, save following content (including the 4th line
with only a dot) in a file (for example: cats.mc):

MessageId=0x1
Language=English
MyCategory1
Jan 31 '08 #4

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

Similar topics

3
by: Rich Protzel | last post by:
Hello, So my table contains say 100,000 records, and I need to group the categories in fld1 by the highest count of subcategories. Say fld1 contains categories A, B, C, D, E. All of these...
0
by: kamaumalone | last post by:
I have a dropdownlist which lives inside of a repeater. The repeater accepts user input via textboxes and the aforementioned dropdownlist. The repeater accepts phone numbers and allows for an...
3
by: Daniel Billingsley | last post by:
The documentation on this subject seems to give you 98% of what you need to know. From various sources, I have compiled an understanding that this should work: <configuration>...
3
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There...
3
by: bhavik | last post by:
hi I have problem that when I am upload my application to the client server, I am losing buttion event on some pages. on some pages button event is working fine ro some pages is not working. I...
1
by: Robert | last post by:
I borrowed one of the forms from the MS Access Solutions database and altered it to fit my needs. The form was the 'EditProducts' form where you select a category from a combo which then populates...
1
by: Max2006 | last post by:
Hi, We are using EventLogWebEventProvider. All events within the event log viewer appear as : Type=Warning Source= ASP.NET 2.0.50727.0 Category= Web Event Is there any way to customize...
7
by: Academia | last post by:
I was told that SqlServer express should get installed when VS2008Pro is installed (that is it is on the same DVD). I had a couple of errors during vs2008's installation and I don't see any...
3
by: =?Utf-8?B?U2F2dm91bGlkaXMgSW9yZGFuaXM=?= | last post by:
I have checked everything, events inside VS2008, or deleting the event and recreating it but nothing worked. I can't even make a breakpoint stop inside the event handler. Is it a bug of VS2008?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.