2011-04-14 10:31:07     How to use syslog at boot?

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-04-14 10:31:07     How to use syslog at boot?

Morten Kvistgaard (DENMARK)

Message: 99847   

 

Hello there,

 

I'm having some trouble finding out how to use the syslogd properly.

 

The story is:

 

I'm starting up a few custom servers at startup. Eg. some Tcp-servers, some serial ... etc. Works fine. I can either start them from inittab or rc. When the servers start up they will log some data to syslog.

 

Only problem is, the logged data won't appear in /var/log/messages. At least not the "startup data". The "after boot log data" works fine though, so my guessing is that my servers are calling syslog *before* syslogd has actually been started.

 

If you want to test it, you can add the folowing line to your rc file:

 

logger test

 

 

 

I've tried different places for starting up the servers, but nothing seems to work. (Eg. placing before or after syslogd in inittab, placing in rc, changing runlevel in inittab etc.)

 

 

 

How are you supposed to use syslog at startup? Any ideas?

QuoteReplyEditDelete

 

 

2011-04-14 14:13:25     Re: How to use syslog at boot?

Mike Frysinger (UNITED STATES)

Message: 99857   

 

simpleinit doesnt provide ordering at all.  it simply spawns everything in parallel.  so i wouldnt be surprised if your app loaded/logged faster than the syslog daemon could.

 

you could either use the busybox's init system which does provide for ordering.

 

or you could launch syslogd in /etc/rc (which is guaranteed to run before anything in inittab) and put a small sleep/delay after it.

 

or, i believe when you first boot, there will be no /dev/log and it wont show up until syslogd is fully ready, so you could have your app wait for that to show up.

QuoteReplyEditDelete

 

 

2011-04-15 03:15:53     Re: How to use syslog at boot?

Morten Kvistgaard (DENMARK)

Message: 99863   

 

I like the idea about "waiting for the log to appear". That ought to do it.

Attachments

    Outcomes