473,405 Members | 2,310 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,405 software developers and data experts.

Eventlog message compiler

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 resourceful.mc content is like this.
MessageId=0x1
Severity=Success
SymbolicName=INSTALL_CATEGORY
Language=English
Installation
..

MessageId=0x2
Severity=Success
SymbolicName=CORE_CATEGORY
Language=English
InetProdukt core
..

MessageId=0x3
Severity=Success
SymbolicName=IO_CATEGORY
Language=English
IO operation
..

MessageId=0x4
Severity=Success
SymbolicName=DATABASE_CATEGORY
Language=English
Database operation
..

MessageId=0x5
Severity=Success
SymbolicName=GARGE_CATEGORY
Language=English
Garage modul
..

MessageId=0x6
Severity=Success
SymbolicName=CARVAN_CATEGORY
Language=English
Carvan modul
..

MessageId=0x7
Severity=Success
SymbolicName=BOAT_CATEGORY
Language=English
Boat modul
..

MessageId=0x8
Severity=Success
SymbolicName=CAMPER_CATEGORY
Language=English
Camper modul
..
2. Then I compile the resource to a win32 native dll with this command
MC.exe -s msresource.mc
rc.exe msresource.res
link.exe /DLL /SUBSYSTEM:WINDOWS /NOENTRY /MACHINE:x86 msresource.Res

3. In my program I create a evensource like this:
int categoryCount = 8;
EventSourceCreationData sourceData;

if (!EventLog.SourceExists(Settings.Default.sourceNam e))
{
sourceData = new EventSourceCreationData("Inet","InetPrdukt");

if
(File.Exists(InetProdukt.Properties.Settings.Defau lt.mcResource))
{
sourceData.CategoryResourceFile = "mcresource.dll";
sourceData.CategoryCount = categoryCount;
}

EventLog.CreateEventSource(sourceData);
}

if (File.Exists("mcresource.dll"))
{
sourceData.CategoryResourceFile = "mcresource.dll";
sourceData.CategoryCount = 8;
}

I then checked the regedit to se if the path was correct
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog\Inet it
was ok

4. In my program I now tried to call the eventlog and set a category
in to ways, the first way I tried was like this:

EventLog eventLog = new EventLog("InetProdukt", ".","Inet");
eventLog.WriteEntry("bla", EventLogEntryType.Error, 5000, 1);
which would show the text "Installation" but I showed the text none
then I tried
eventLog.WriteEntry("bla", EventLogEntryType.Error, 5000, 0x1);
which would show the text "Installation" but I showed the text (1)
instead.

I'm using a Danish culture in my program. I have tried without this
same result
System.Threading.Thread.CurrentThread.CurrentCultu re = new
System.Globalization.CultureInfo("da-DK");
System.Threading.Thread.CurrentThread.CurrentUICul ture =
new System.Globalization.CultureInfo("da-DK");
Feb 20 '07 #1
0 1793

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

Similar topics

2
by: rgilmore | last post by:
Our app uses the EventLog class to write errors to the event log. Sometimes the app runs unattended for days, and if errors are occurring, the event log can fill up, causing the app to have no way...
5
by: timb | last post by:
Hi, am creating a windows service using c# and would like it to create a new eventlog logtype and add it to the eventlog viewer so that i can log all messages relating to this application to this...
1
by: john s | last post by:
I am trying to create a message text file for the Catagory field in order to map the catagory input number to a string text. I have found some MSDN information on this, but it appears to only be...
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...
6
by: MattC | last post by:
I have some code that correctly writes to the eventlog on my local machine. I have installed the application on the Live server and all is not well, no event log entries. My development box...
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)....
7
by: Rob R. Ainscough | last post by:
I'm having difficulty writing anything to the web servers event log from my web app located on that server. Putting this in my web apps web.config did NOT help - immediate causes and error in my...
1
by: Jacob | last post by:
I have the following code in a class... --------------------------------------------------------------------------------- .... Private _eL As EventLog = Nothing Private _eLName As String =...
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: 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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.