Solved

eventlog.writeentry ... no error, but nothing is written?

Posted on 2010-11-08
3
502 Views
Last Modified: 2012-05-10
Hi, I have tried executing the below code... and it works fine, there is no error. But, as the above title suggests, when i look at the application event in the eventviewer... nothing is written there regarding this error.

I used different code to create a custom event log and i was able to write to that ok. Does anyone know what i'm doing wrong here? Using windows XP and visual studio 2005 windows form application.

Thanks, Aiden
If Not EventLog.SourceExists("RevenueByCountryAndIC01") Then

   EventLog.CreateEventSource("RevenueByCountryAndIC01", "Application")

End If



Dim log As New EventLog("Application")

log.Source = "RevenueByCountryAndIC01"

log.WriteEntry("Error is test1", EventLogEntryType.Error, 1)

Open in new window

0
Comment
Question by:AidenA
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
tomnorra earned 500 total points
ID: 34086846
you may need to include the machine name and source in your New dimension.
Dim log As EventLog = New EventLog("Application", System.Environment.MachineName, "RevenueByCountryAndIC01")
0
 

Author Comment

by:AidenA
ID: 34092469
Hi yeah that seemed to work thanks... any reason why i would have needed that? it doesn't automatically realise you're referring to the local machine?

i didn't need it when creating a custom eventlog (i.e. not application, but my own one)
0
 
LVL 3

Expert Comment

by:tomnorra
ID: 34093883
You need it because the system has to make sure the machine has permissions to write to the Application Log
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now