This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Writing to the Windows Event Log

On Thu, 19 Jun 2003, Siegel, Tom wrote:

> I would like to be able to write to the Windows event application log
> with my shell scripts running on Cygwin. Any "tried and true" solutions
> would be appreciated.
> Thanks,
> Tom

Umm, do you have to do it from a shell script?  I'm assuming you want to
do this under NT or 2000, right?  You could simply use syslog(), you know.
Something like

#include <syslog.h>
int main(int argc, char *argv[]) {
  if (argc != 2) return 1;
  syslog(LOG_MAKEPRI(LOG_SYSLOG,LOG_ALERT), "%s", argv[1]);

DISCLAIMER: I haven't tested or compiled the above, but it should work
pretty much as advertised.  Hope this helps,
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]