473,473 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

User EventLog and Vista

Hi,

I'm using an user defined EventLog called "Fist Full of Lasers" within a C#
service. The Log is created during the installation of the service in which
the first entry of the log is written also.

This works fine with Windows XPSP2. However, with Vista all entries are
written in the Application-Log and not the "Fist Full of Lasers" Log:

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.ServiceProcess;
using System.Configuration.Install;
using System.Diagnostics;
using System.Windows.Forms;

namespace LogicLink.ffol {

[RunInstaller(true)]
public class ILDACMSSVRInstaller : Installer {

private ServiceInstaller _si;
private ServiceProcessInstaller _spi;

public ILDACMSSVRInstaller() {

_si = new ServiceInstaller();
_si.ServiceName = "ffolsvr";
_si.DisplayName = "Fist full of Lasers";
_si.Description = Properties.Resources.ServiceDescription;
_si.StartType = ServiceStartMode.Automatic;
foreach(Installer inst in _si.Installers) {
if(inst is EventLogInstaller) {
((EventLogInstaller)inst).Log = "Fist Full of Lasers";
}
}

_spi = new ServiceProcessInstaller();
_spi.Account = ServiceAccount.LocalService;

Installers.Add(_si);
Installers.Add(_spi);
}

protected override void
OnAfterInstall(System.Collections.IDictionary savedState) {

EventLog lg = new EventLog();
lg.Source = "ffolsvr";
lg.WriteEntry("Fist Full of Lasers service installed.");

base.OnAfterInstall(savedState);
}
protected override void
OnAfterUninstall(System.Collections.IDictionary savedState) {

// Lösche Log
if(EventLog.Exists("Fist Full of Lasers", "."))
EventLog.Delete("Fist Full of Lasers");

base.OnAfterUninstall(savedState);
}
}
}
Many thanks in advance,

Marcus
Jan 6 '08 #1
0 1397

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joe | last post by:
I am trying to read the EventLog of different servers on the network. If I run the script in a command line, it works well. But when I try to put the script into the Web server (IIS in Windows...
2
by: Next | last post by:
Hello all, I have a windows service that was suppose to write some events into its own EventLog. I created the EventLog using the component on VS 2003 toolbar Added an installer for it. Set...
3
by: KarlM | last post by:
I would like to write to the EventLog (Application) with following code. But this works only under admin account. There are no restrictions in the WriteEntry-documentation. Can anyone help me? ...
3
by: musosdev | last post by:
Hi I'm using the following code in a global class to add to the Windows EventLog every time a try{} catch{} block fails... if(!EventLog.SourceExists("darts"))...
1
by: martin | last post by:
Hi, I'm having some problems with the System.Diagnostics.EventLog class in .NET 2.0 I need to recreate an event message source inside a new log but the messages keeps ending up in the old...
3
by: Ben | last post by:
I am trying to write an eventlog monitor. I am using the sample code provided by VB2005 SDK as the bases for my application. I need to monitor all three logs (application, system, and security)....
0
by: =?Utf-8?B?Y2FsZGVyYXJh?= | last post by:
Dear all, I am trying using .NEt 2.0 to create a custom Log entry under Vista OS, where I will place my log inoformation. For that I am doing as follow : First I am ckecking if the log...
3
by: Olegus | last post by:
My Windows application if running on Vista crashed on the next statements( with ----in the front): if (!EventLog.SourceExists(Event.EventLogSource))...
1
by: Jeff | last post by:
hi ..Net 2.0 I've created the code below and think I've executed it. After I thought I've executed it I checked in EventLog on the computer (win2k3) and no entry was added. This could mean 2...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.