Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Having switched from Apache (mpm prefork) to Nginx with php5-fpm I'm finding the error logs unpleasant to parse.

For example Nginx will produce something like this (specifics redacted):

2012/03/12 09:56:59 [error] 22075#0: *432 FastCGI sent in stderr: "PHP Warning:  require_once([somefile]): failed to open stream: No such file or directory in [sourcefile] on line 6
PHP Fatal error:  require_once(): Failed opening required '[somefile]' (include_path='.:/usr/share/php:/usr/share/pear') in [sourcefile] on line 6" while reading response header from upstream, client: [ip], server: [host].*, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "[host]"

Which contains a lot of information I'm not really interested in 99% of the time while developing/debugging.

Apache used to output something much more readable, such as:

[date] [error] [client] PHP Warning:  require_once([somefile]): failed to open stream: No such file or directory in [sourcefile] on line 6
[date] [error] [client] PHP Fatal error:  require_once(): Failed opening required '[somefile]' (include_path='.:/usr/share/php:/usr/share/pear') in [sourcefile] on line 6"

Mostly easier to scan due to the actual error appearing first (as opposed to the FPM details) and being column aligned in a terminal.

Is there any way I can make Nginx behave more like Apache with respect to error logging?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.