Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Call to Syscall.syslog does not write any message to the given log file on OSX Lion.
Mono 2.10.9 (tarball Mon May 7 20:25:51 EDT 2012)
Package version: 210090011
Relevant line in /etc/syslog.conf:
After the modification syslogd was restarted with:
killall -HUP syslog
The code that is supposed to write to the log file:
public static void Main(string args)
Syscall.syslog(SyslogLevel.LOG_DEBUG, "Test message for logging from BackupTool!");
However no entries are written into the log.
sorry for the typo, the restart command is correctly:
killall -HUP syslogd
(The correct command was given on the command line, just the error report has the typo.)
Additional investigation shows that it seems that on OSX Lion only message level 5 (LOG_NOTICE) and above are valid (for testing, see the attached test program).
Created attachment 2196 [details]
Test program for sending all level log entries with direct and Mono calls to syslog
This isn't a Mono binding bug, this is an OS X configuration "bug"/issue (as the same thing will happen in C, as seen by your manual P/Invoke); see:
If you want LOG_NOTICE messages to be logged in syslog, you need to edit /etc/syslog.conf and add an entry for *.debug. See also:
Even writing *.debug does not log the LOG_DEBUG information (just checked it again). Is there any other condition that should be met?
And I know that this is happening with C, because I checked it with DllImport (even there with LOG_DEBUG and *.debug it is ignored).
However there is one more issue related to the problem (and this is the main reason for reporting the error):
- In C you use integers for defining the interval accepted with the syslog function.
- In Mono, you use the SyslogLevel enumeration, which suggests that all value of the enumeration is valid (however as indicated two of them is invalid in this context). I think at least some warning should occure if this is really an OS problem.
> Is there any other condition that should be met?
I don't know. :-(
As for integers vs. enumerations, the enumerations are hand-written against the POSIX standard. SyslogLevel.LOG_NOTICE exists because POSIX defines it, as does syslog(3) on OS X. It's a valid value. OS X just happens to ignore it, but it is a valid POSIX value.
I'm not sure how/where "some warning" should even work. OS support for syslog values is inherently OS specific, and there's no way for the C# compiler to warn that a given value isn't supported. MonoPosixHelper could presumably generate an LOG_ERROR message if you generate a LOG_NOTICE message on OS X, but that sounds wrong/bad, and afaik there's no way to check at runtime if a given log level will be ignored or not.
In short, this is an OS configuration issue, outside the bounds of Mono.Posix.dll.