Link to home
Start Free TrialLog in
Avatar of AidenA
AidenA

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of tomnorra
tomnorra

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AidenA
AidenA

ASKER

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)
You need it because the system has to make sure the machine has permissions to write to the Application Log