How to get output from upstart jobs when logged in via SSH?

Solution 1:

As of 12.04 (Possibly before), by default, upstart will log to a file under /var/log/upstart/ with any output from the job

Current documentation of Upstart (on Cookbook)

You can then tail that file to see all new text that is being written to the file

For example:

tail -f /var/log/upstart/test.log & # tail the output
initctl emit test

Solution 2:

Since init (pid 1) is running the service (which has no stdout/stderr) and not your shell (like with older /etc/init.d-style scripts), there is presently no way to see the output that is generated. (This feature is frequently requested and is on the list of things to do for Upstart.)

To work around this, I recommend forcing output redirection at the start of the job itself:

script
    exec >/var/log/test.debug 2>&1
    echo Gotcha...
end script