On Dec 1, 2010, at 2:37 PM, <[email protected]> <[email protected]> wrote:
> If I use:
>
> Syscall.syslog(SyslogFacility.LOG_DAEMON, SyslogLevel.LOG_NOTICE, "myMsg");
>
> this appears with identifier "mono:" in the syslog. To make syslog
> more evaluable, I need to define my own identifier instead.
You need to use Syscall.openlog() before calling Syscall.syslog() to provide
the ident string:
http://go-mono.com/docs/index.aspx?link=M:Mono.Unix.Native.Syscall.openlog(System.IntPtr,Mono.Unix.Native.SyslogOptions,Mono.Unix.Native.SyslogFacility)
You can find more info by reading the Linux man pages, in particular the
openSUSE openlog(3) page states:
The argument ident in the call of openlog() is probably stored as-is.
Thus, if the string it points to is changed, syslog() may start
prepending the changed string, and if the string it points to ceases to
exist, the results are undefined. Most portable is to use a string
constant.
Which is why the first character to Syscall.openlog() is an IntPtr, not a
string; you'd thus want to call as:
Syscall.openlog(Marshal.StringToHGlobalAnsi("my-ident"), 0, 0);
- Jon
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list