Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows Services and Custom Event Logs
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Windows Services and Custom Event Logs
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01085188
Message ID:
01085188
Vues:
97
Hi all,

I'm writing a Windows Service application and I'm trying to use a Custom Event Log (as opposed to the one that is already part of the ServiceBase class. I have this code:
<
>
// Setup a Custom Event Log.
this.log = new EventLog("Tuesday Morning", ".", "Job Control Launcher");
<
>
Later in code I call the WriteEntry method and the following gets generated in the standard Application Event Log:
<
>
Event Type:	Error
Event Source:	Job Control Launcher
Event Category:	None
Event ID:	0
Date:		1/9/2006
Time:		4:16:31 PM
User:		N/A
Computer:	CHADBXP
Description:
The description for Event ID ( 0 ) in Source ( Job Control Launcher ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Service cannot be started. System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.
   at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)
   at System.Diagnostics.EventLog.SourceExists(String source, String machineName)
   at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName)
   at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type)
   at TM.JobControl.JobControlLauncher.start()
   at TM.JobControl.JobControlLauncher.OnStart(String[] args)
   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
The Zone of the assembly that failed was:
MyComputer.
<
>
So, it seems that the Local System (the account under which the service runs) can't see the custom event log. I know I can use the standard event log, but the question is, do I <>have<> to for logging purposes? I use this sort of custom log in other classes that get called by other Windows services I've written and it works fine.

TIA,
Chad
_________________________________
There are 2 types of people in the world:
    Those who need closure
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform