Solved

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

Posted on 2010-11-08
3
503 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

896 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

13 Experts available now in Live!

Get 1:1 Help Now