apache2.4.7 not logging "404 Not Found" pages to error.log

I've seen questions about how to not log 404 errors to the error log, this is the opposite.

For some reason my apache installation does not log 404 errors to my error log (or to my access log for that matter). I have set the error log properly and see errors going to it, but when I access non-existent pages I simply get my 404 error - the access (but not the 404 error) shows up in the access.log, but I don't see anything in the error log (which makes it hard, for example, to debug why some pages aren't showing up).

My apache (2.4.7) conf settings regarding logs (in the order they are set) are:

ErrorLog ${APACHE_LOG_DIR}/error.log
ErrorLog logs/error_log
LogLevel warn  # Though I've tried setting this to debug
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"" common
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
CustomLog logs/access_log common
LogFormat "%{HOST}i %h %l %u %t \"%r\" %s %b \"%{User-Agent}i\"" vcommon
CustomLog logs/access_log vcommon

So the only ones that I think are relevant to error log (ignoring overwritten settings) are:

ErrorLog logs/error_log
LogLevel warn  # Though I've tried setting this to debug

Upvotes: 3

Views: 3807

Answers (2)

Finally figured this out.

LogLevel needs to be set to something like 'info' - for some reason the LogLevel of 'warn' which use to log 404 errors no longer does so.

I don't know if 'debug' would work, my question implies that it wouldn't, but I also realized that I had LogLevel set in two places.

Upvotes: 2

5kKate
5kKate

Reputation: 61

Good question I'm not sure how to configure apache to do this. Usually to find my errors I just search my access log. You can do this with grep or awk. A really basic command to try is:

grep ' 404 ' access.log

Upvotes: 0

Related Questions