[Mono-devel-list] System.Diagnostic.EventLog

Robert Brown robert at rpb3.com
Fri Oct 1 06:01:51 EDT 2004


J-
  I did a google search on mono and syslog and found a quick example
[http://www.mail-archive.com/mono-list@lists.ximian.com/msg10313.html]. 
Between what you listed below and the webpage that google pulled up
should get me started.

  Thanks for all your help, Linux calls are still really new for me.

-=Robert


> On Fri, 2004-10-01 at 10:06, Robert Brown wrote:
>> J-
>>   Is there a place on the web that I can find the code for the P/Invoke
>> to
>> syslog so i can read and write from/to it?  I'm a newbie to the
>> P/Invoke<->Linux stuff, so probably any type of resource is better than
>> none.
>>
>
> You would probably want something (off the top of my head and untested)
> like:
>
> 	[DllImport("libc"]
> 	static extern void openlog(string ident, int option, int facility);
>
>         [DllImport("libc"
>         static extern void syslog(int priority, string format, params
> string[] args);
>
>         [DllImport("libc")]
>         static extern void closelog();
>
>
> Then you should be able to do
>
> 	// Kernel Message with no options
>
>         openlog("MyProgram",0,0);
>
>         // Panic! LOG_EMERG = 0
>
>         syslog(0,"Whoah %s", "It went wrong");
>
>         closelog();
>
> I'll get a working example together on the train home :-)
>
>>   Could the mapping of the syslog facilities and priorities be done in a
>> config file?
>>
>> -=Robert
>>
>>
>> > On Fri, 2004-10-01 at 00:50, Jonathan Pryor wrote:
>> >> On Thu, 2004-09-30 at 09:09, Robert Brown wrote:
>> >> > Does anyone what the status of the System.Diagnostic.EventLog class
>> >> is?  I
>> >> > looked on the Mono project website (www.go-mono.com) but can't find
>> >> the
>> >> > Class Status page.
>> >>
>> >> There's *an* implementation...which pretty much does nothing.
>> >>
>> >> So you can (probably) compile against it, but it won't do anything.
>> >>
>> >
>> > Is this something that is planned to be implemented, and if so is
>> anyone
>> > working on it? For writing to the log would it be preferable to
>> P/Invoke
>> > the syslog(3) interface (and the analogous API for the EventLog on
>> > windows) or reimplement from scratch? As for getting events can it be
>> > relied upon that the syslogd will be able to write to a fifo instead
>> of
>> > a plain file (of course to use this the user would have to alter
>> > syslog.conf) then waiting for an event could spawn a thread that reads
>> > from the fifo.
>> >
>> > Of course I guess the biggest problem will be mapping the syslog
>> > facilities and priorities to the stuff that you get in Windows.
>> >
>> > Not that I am promising to write anything :-)
>> >
>> > /J\
>> > --
>> >
>> > This e-mail is sponsored by http://www.integration-house.com/
>> >
>> > _______________________________________________
>> > Mono-devel-list mailing list
>> > Mono-devel-list at lists.ximian.com
>> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
>> >
>> >
> --
>
> This e-mail is sponsored by http://www.integration-house.com/
>
>
>





More information about the Mono-devel-list mailing list