[Mono-list] logging to remote syslog servers

Mike Christensen mike at kitchenpc.com
Thu Feb 10 16:37:06 EST 2011


> I have been able to log requests to the local syslog server just fine. How
> to I edit my code to send the logs to a remote syslog server? Also, is there
> a way to change what computer name is sent to the syslog? We will be using
> this program in a Netboot environment for our Mac build process and the
> computer name will not be set yet. Just the randomly generated name.
>
>
>
> IntPtr ident = Marshal.StringToHGlobalAnsi("Network Software");
>
> Syscall.openlog(ident, SyslogOptions.LOG_PERROR | SyslogOptions.LOG_PID,
> SyslogFacility.LOG_DAEMON);
>
> Syscall.syslog(SyslogFacility.LOG_DAEMON, SyslogLevel.LOG_NOTICE, "Test
> Message");
>
> Syscall.syslog(SyslogFacility.LOG_DAEMON, SyslogLevel.LOG_NOTICE, "Test
> Message 2");
>
> Syscall.closelog();
>
> Marshal.FreeHGlobal(ident);

I don't know anything about syslog, but if I recall correctly, log4net
is able to handle this sort of thing pretty well.  It's a free and
open source logging library that works pretty well, and at the very
least maybe you can dig through the source code.


More information about the Mono-list mailing list