The attached patch makes elog() write the message to stderr if there is no frontend to talk to.
Attach a file by drag & drop or click to upload