NT Services and EventLog problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Larry Bates

    NT Services and EventLog problems

    I have tried everything I know to get my NT service
    to make correct entries in the NT Event Log when the
    service is started and stopped (and eventually when
    permanent failures occur).

    I'm copying the code I see on page 356 of Python
    Programming on Win32 and for the life of me I cannot
    get this to work properly. Basically I have
    the following code snippet at the top of my SvcDoRun
    method:

    import servicemanager
    servicemanager. LogMsg(
    servicemanager. EVENTLOG_INFORM ATION_TYPE,
    servicemanager. PYS_SERVICE_STA RTED,
    (self._svc_name _,''))

    I also inserted the following to make the proper
    registry entries when the service is installed:

    win32evtlogutil .AddSourceToReg istry('AFR',
    'C:\Python22\Li b\site-Packages\win32\ PythonService.e xe',
    'Application')

    The entry that gets put into the Event Log is as follows:

    The description for Event ID ( 4098 ) in Source
    ( PythonService ) 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: AFR, .

    Note: _svc_name_="AFR "

    Something is not set correctly, but for the life of me
    I cannot determine what.

    Thanks in advance for any assistance.

    Regards,
    Larry Bates


  • F. Petitjean

    #2
    Re: NT Services and EventLog problems

    On Mon, 1 Mar 2004 17:20:10 -0600, Larry Bates <lbates@swamiso ft.com> wrote:[color=blue]
    > I have tried everything I know to get my NT service
    > to make correct entries in the NT Event Log when the
    > service is started and stopped (and eventually when
    > permanent failures occur).
    >
    > I also inserted the following to make the proper
    > registry entries when the service is installed:
    >
    > win32evtlogutil .AddSourceToReg istry('AFR',
    > 'C:\Python22\Li b\site-Packages\win32\ PythonService.e xe',
    > 'Application')[/color]

    Second parameter seems too be a filepath, try to use raw strings :
    r'C:\Python22\L ib\site-Packages\win32\ PythonService.e xe'
    and launch regedit to check registry entries.[color=blue]
    >
    > Thanks in advance for any assistance.
    >[/color]
    Regards,

    Comment

    Working...