Skip to contentSkip to conversation

Re-2: rt_printf with daemonized task

Xenomai-help [email protected] 3 participants 3 messages Oct 7, 2009

lore
Share & tools
lore
#0 lore raw

After tracking down the issue a little bit further, it seems not to be a problem of daemonizing a server task, but to change a line of code in rtprint.c

What I would like to achieve :
- My server process is setting up two Xenomai threads
- Both Xenomai should report some messages with rt_printf()
- rt_printf-function should write not to stdout or stderr but to the syslog

Therefor I changed the code for output the message in rt_print.c from
fprintf(head->dest, "%s", head->text);
to
syslog( LOG_ERR | LOG_LOCAL4, head->text );

Problem :
The syslog() call is not doing any output the syslog file, it doesn't matter if the process is daemonized or not.

Oliver

To: [email protected]
Cc: [email protected]

#1 lore raw
Quoted 2 lines · [email protected] wrote:

The syslog() call is not doing any output the syslog file, it doesn't matter if the process is daemonized or not.

The syslog() syscall is handled by the syslogd daemon. So, you should check if the syslogd daemon is running and if it is correctly configured.

Signature · 1 line
                                          Gilles
#2 lore raw
In reply to [email protected]

Hi,

Quoted 11 lines · On Wed, 2009-10-07 at 13:13 +0000, [email protected] wrote:

After tracking down the issue a little bit further, it seems not to be a problem of daemonizing a server task, but to change a line of code in rtprint.c

What I would like to achieve :
- My server process is setting up two Xenomai threads
- Both Xenomai should report some messages with rt_printf()
- rt_printf-function should write not to stdout or stderr but to the syslog

FYI: That's how we tackled this problem:

We created a RT_PIPE object. Both threads are writing their messages to the pipe. Together with the Xenomai application we have 'logger'
running: 'logger -f /dev/rtpXX -t <your process name> &' which takes everything which gets written to RT_PIPE and sends it to the syslog daemon.

Andreas