473,750 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=Succes s
SymbolicName=IN STALL_CATEGORY
Language=Englis h
Installation
..

MessageId=0x2
Severity=Succes s
SymbolicName=CO RE_CATEGORY
Language=Englis h
InetProdukt core
..

MessageId=0x3
Severity=Succes s
SymbolicName=IO _CATEGORY
Language=Englis h
IO operation
..

MessageId=0x4
Severity=Succes s
SymbolicName=DA TABASE_CATEGORY
Language=Englis h
Database operation
..

MessageId=0x5
Severity=Succes s
SymbolicName=GA RGE_CATEGORY
Language=Englis h
Garage modul
..

MessageId=0x6
Severity=Succes s
SymbolicName=CA RVAN_CATEGORY
Language=Englis h
Carvan modul
..

MessageId=0x7
Severity=Succes s
SymbolicName=BO AT_CATEGORY
Language=Englis h
Boat modul
..

MessageId=0x8
Severity=Succes s
SymbolicName=CA MPER_CATEGORY
Language=Englis h
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:WINDO WS /NOENTRY /MACHINE:x86 msresource.Res

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

if (!EventLog.Sour ceExists(Settin gs.Default.sour ceName))
{
sourceData = new EventSourceCrea tionData("Inet" ,"InetPrdukt ");

if
(File.Exists(In etProdukt.Prope rties.Settings. Default.mcResou rce))
{
sourceData.Cate goryResourceFil e = "mcresource.dll ";
sourceData.Cate goryCount = categoryCount;
}

EventLog.Create EventSource(sou rceData);
}

if (File.Exists("m cresource.dll") )
{
sourceData.Cate goryResourceFil e = "mcresource.dll ";
sourceData.Cate goryCount = 8;
}

I then checked the regedit to se if the path was correct
HKEY_LOCAL_MACH INE\SYSTEM\Curr entControlSet\S ervices\Eventlo g\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("InetP rodukt", ".","Inet") ;
eventLog.WriteE ntry("bla", EventLogEntryTy pe.Error, 5000, 1);
which would show the text "Installati on" but I showed the text none
then I tried
eventLog.WriteE ntry("bla", EventLogEntryTy pe.Error, 5000, 0x1);
which would show the text "Installati on" but I showed the text (1)
instead.

I'm using a Danish culture in my program. I have tried without this
same result
System.Threadin g.Thread.Curren tThread.Current Culture = new
System.Globaliz ation.CultureIn fo("da-DK");
System.Threadin g.Thread.Curren tThread.Current UICulture =
new System.Globaliz ation.CultureIn fo("da-DK");
Feb 20 '07 #1
0 1816

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

Similar topics

2
5260
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 of reporting further errors. The user needs to manually clear the event log in this case To prevent this, we would like to specify the "Overwrite as needed" option on our event log to make it circular. This option is available as a checkbox on...
5
2336
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 specific log. Does anyone have any code for this which works as i have tried the examples but am unable to find the log in the eventlogviewer or anywhere on the hard drive afterwards. Thanks in advance TimB
1
7288
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 for C/C++. What I have found in MSDN so far can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/message_files.asp and...
2
3545
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 all the appropriate properties to assign the new Source to a new log. For some reason installutil.exe created the source in the correct log. But
6
1709
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 config is as follows: Windows XP Pro running IIS 5.1 Web app using integrated auth using a local user account Account has admin right over machine. Entry has been placed in registry in
1
15986
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 log?! I have simplified my code into this tiny snippet: EventLog.CreateEventSource("mySrc", "myLog1");
3
4837
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). How can I monitor all three logs at once? Thanks,
7
7462
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 web app before it displays the default page. <healthMonitoring> <rules> <add name="All Events" eventName="All Events" provider="EventLogProvider" profile="Critical" />
1
3554
by: Jacob | last post by:
I have the following code in a class... --------------------------------------------------------------------------------- .... Private _eL As EventLog = Nothing Private _eLName As String = My.Settings.EventLogName Private _sourceName As String Private Sub New() ' Require user passes source name.
0
8839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9584
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9257
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4894
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2227
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.