in reply to Re^5: Debugging Windows Services created with Win32::Daemon (STDERR)
in thread Debugging Windows Services created with Win32::Daemon

I suspect that won't catch output to STDERR nor non-zero exit status.

You are correct, my memory was fuzzy. In order for the exit status of the service to raise an event message log, the service has to

If a service calls SetServiceStatus with the dwCurrentState member set to SERVICE_STOPPED and the dwWin32ExitCode member set to a nonzero value, the following entry is written into the System event log:

Event ID = 7023 Source = Service Control Manager Type = Error Description = <ServiceName> terminated with the following error: <ExitCode>.

This is available via the Win32::Deamon function

State( { state => SERVICE_STOPPED, waithint => 0, error => $exit_code +} );

STDERR will only log to the eventlog if the programmer arranges for it to do so through a tied filehandle or signal handlers. Which would work for program generated errors, but probably not those coming from withn the Perl executable like panics.

Though, if enabled, segfaults will be logged.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.