Solved

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

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal reports login after closing form 3 35
Problem to Office 1 43
SSIS GUID Variable 2 33
Header Font Size in Grid View 6 25
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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