Link to home
Start Free TrialLog in
Avatar of xavier_da
xavier_daFlag for Australia

asked on

cygwin1.dll - Redirect syslog() calls to file instead of Windows Event Log

Hi there,

I have an app that is built against cygwin, producing an x86 WIN32 executable. This is a console app. However, its default behaviour (presumably because it uses functions in cygwin1.dll) is to send any calls to syslog() under a Windows environment to the Windows Event Log (can be seen in Event Viewer).

Is there a simple way, without changing the source code, say by placing a config file somewhere, that changes this behaviour such that any log information is redirected to a file not the Windows Event log? Or alternatively, sends nothing at all (some /dev/null equivalent)?

Hoping I can avoid removing all such calls and recompiling...

Kind regards,

Xav.
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Hi,

I'm not very familiar with Cygwin, but it seems that you need a running syslogd to capture the messages to a logfile.

As far as I know there is a syslogd in inetutils
http://sourceware.org/cygwin/packages/inetutils/ (package list)


and a syslog-ng implementation is also available:
http://sourceware.org/cygwin/packages/syslog-ng/ (package list)

Both packages should contain READMEs to give you a start.

wmp



Avatar of xavier_da

ASKER

Hi woolmilkporc,

Thanks for your response. However, this is a standalone executable built using Cygwin - I have no actual Cygwin environment installed.

My understanding is that the cygwin1.dll provides a layer to abstract services and features typical of a Unix environment, such that calls to normal functions (such as syslog()) are portable, and can run under Windows. In this case, code that under a Unix environment would cause a message to be sent to the syslog daemon is passed onto the Windows equivalent (Event Viewer).

Is there a cygwin1.dll file with different logging functionality? I'd be happy to remove any logging, yet keep the calls in there, so it essentially calls a stub function of some kind.

I assume the Windows implementation of the syslog() function call does some checks to see how to send messages. Maybe it checks for the presence of a file in the same directory as the calling application (with cygwin1.dll), a text file that alters the logging behaviour?

Or failing that, is the only way to do what I want to:
a) alter the cygwin1.dll to exclude syslog()
b) add conditional code and a command line option to NOT send any messages.
c) ???

What other alternatives are there?

Regards,

Xav.
ASKER CERTIFIED SOLUTION
Avatar of xavier_da
xavier_da
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Solution found independently of wider EE community; meets original goal.