[erlang-questions] logging from linked-in drivers
Wed Sep 21 15:29:46 CEST 2011
On 21 September 2011 09:49, Max Lapshin <> wrote:
> I may be 10 times wrong, but it seems for me that the most convenient
> and simple way of logging is stderr/stdout, captured by runit
Yeah, this is what I do with debugging statements. I'd like to put
individual log lines/entries out to the file system rather than the console.
Given that posix requires stdio operations dealing with FILE* structures to
work atomically, do you think fprintf calls are a reasonable thing to do in
a multi-threaded driver?.
> If you wish to do complicated logging, I recommend sending messages to
> owner process, that will be rerouted to some erlang level logger.
I'll have a look into this. I had considered doing so using driver_send_term
to send data to an arbitrary (e.g., logging) process that is specified
during driver initialisation, but wondered whether the overhead was going to
be too high. Also that call is only thread safe when the SMP emulator is in
use, which means using a driver mutex the rest of the time.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions