upstart logging output enabled
Asked Answered
S

3

31

Except doing explicit logging instructions like suggested in http://upstart.ubuntu.com/wiki/Debugging, is there a way to enable output of what is happening with upstart?

  • What event is raised
  • What service changed its status (started/stopped/dead)
  • What signal were emmited
  • what output a service produced while starting
Sula answered 2/12, 2010 at 13:10 Comment(2)
Perhaps this question might be more appropriate on serverfault.comMongoloid
It's relative to both server and desktop... Should I close this one and re-open in serverfault?Sula
S
36

Ok, I've found one way to get it :

$ sudo initctl log-priority        # gives the actual (default) logging level
$ sudo initctl log-priority --help # gives available logging levels
$ sudo initctl log-priority info # is enough to get :
$ tail -f /var/log/syslog        # - log of upstart events
$ tail -f /var/log/boot.log      # - log of services output
Sula answered 3/12, 2010 at 10:44 Comment(5)
hey! Ubuntu 11.10 here and there is no /var/log/boot.log for me, just /var/log/boot. That doesn't produce any process output though, i tried echo 'hi' and it's not showing up in /var/log/boot. Any tips?Ninette
@rdrey: /var/log/kern.log maybe?Ochs
@AtilaRomero maybe ;) I actually don't remember this question/comment at all, sorry.Ninette
I am using Ubuntu 12.10 now, why I still cannot get the log following your steps?Intercrop
You may need to add $KLogPermitNonKernelFacility on to rsyslogd's config, as detailed here: askubuntu.com/a/490900/297973Womanlike
I
19

In newer versions, you can find the upstart logs at:

/var/log/upstart

It has a log for each process it tries to start.

Irregular answered 1/5, 2014 at 5:25 Comment(1)
FTR: That is true for 12.04 and 14.04 but not for 10.04.Breastplate
O
8

initctl log-priority info logs events, but ignores the program output.

If the program output is important to you, I think the complementary solution is to use logger in your init script:

script
    myawesomeprog 2>&1 | logger -t myawesomeprog
end script

Because it's better to use syslog than manually manage /var/log, like http://upstart.ubuntu.com/wiki/Debugging suggests (in 08/2012).

Ochs answered 2/8, 2012 at 20:15 Comment(1)
Doesn't give any output for me using: su -c "$DAEMON $DAEMON_OPTS" $ES_USER 2>&1 | logger -t elasticsearchAbsolute

© 2022 - 2024 — McMap. All rights reserved.