Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-11-08
3
Medium Priority
?
511 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
tomnorra earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

721 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