[Serusers] \n in log statements

Andrei Pelinescu-Onciul pelinescu-onciul at fokus.fraunhofer.de
Sat Mar 20 01:00:22 CET 2004


On Mar 19, 2004 at 23:21, Klaus Darilion <klaus.mailinglists at pernau.at> wrote:
> Hi!
> 
> I tried \n in log and xlog messages to enforce line breaks (to write 
> some debug info over multiple lines), but this does not work. I even 
> tried \r and \r\n, but none of them works, the logging in 
> /var/log/messages is always in the same line (tested on suse&redhat).

Yes, syslog eats \n and will always append \n at the end of a log
message.
> 
> But in the sample scripts there are always \n in the log statements, 
> even at the end of the string.

Yes, so logging to stderr would work nicely.

To add \n support to syslog, one would need to parse the string before
sending it to syslog and break it at \n (sending one message for each
line).  I think this is too expensive  (for just having nicer log
messages), but we might do it in the future (very low priority).


Andrei




More information about the sr-users mailing list