[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How can I write an event log to a remote PC.

Posted on 2010-01-07
4
Medium Priority
?
466 Views
Last Modified: 2012-05-08
I am trying to add event logging to a client/server app.  I would like all the clients to be able to write events to a remote machine so an admin will have them all in one place.  

I have this working to create a new log and branch in the Event Viewer on the remote machine, "GLENN".  
      Dim s As New EventSourceCreationData("AppName", "AppLogName")
      s.MachineName = "GLENN"
      EventLog.CreateEventSource(s)

But when I execute this there is no way to specify the Machine Name and so the entry appears in the local machine log.  
      EventLog.WriteEntry("AppName", Message, EventLogEntryType.Information, 1234)

Thanks for your help,
Glenn
0
Comment
Question by:GlennHolden
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
bhermer earned 1600 total points
ID: 26202089

 Dim logger As EventLog = New EventLog("Application", "VirtualDev01", "MyApplication")
logger.WriteEntry("HelloWorld")

will write helloworld in the application log on virtualdev01 under the application source of MyApplication
0
 
LVL 4

Expert Comment

by:bhermer
ID: 26202101
Dim logger As EventLog = New EventLog(LogName, LogMachineName, SourceName)
0
 
LVL 41

Assisted Solution

by:graye
graye earned 400 total points
ID: 26202739
In addition to the correct info above, you may also have to manually create the "event source" on the remote PC first.  It's also possible that you'd need to change the permission for this source.
http://msdn.microsoft.com/en-us/library/xz73e171.aspx 
0
 

Author Closing Comment

by:GlennHolden
ID: 31674072
Thank you both.  The syntax is what I was looking for.  I appreciate the security issues though.  
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 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