One thing to note about this: the process could have ended already, so the log message with the PID will come after whatever debugging messages happen from the process itself.  Just something to keep in mind as you use this.