Implementing logging facilities and pid file handling