Writing to the Windows Event Log

Igor Pechtchanski pechtcha@cs.nyu.edu
Thu Jun 19 21:37:00 GMT 2003


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,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,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:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list