# Apache webserver not logging errors to error log file.



## carltonfsck (Apr 10, 2020)

Greetings,

I'm running Apache/2.4.43 on FreeBSD 11.3-RELEASE-p7.  I'm have this issue that I cannot seem to figure out.  Even after Googling under the sun and searching various other forums, I cannot explain the reason for my issue.  

My issue: 

Anytime I do a remote test browse for a file or resource that doesn't exist on my Apache web server, the Apache error log that I have configured does not show any errors ("File does not exist", "Script not found or unable to stat," etc., etc...).

I have the error log specified in the httpd.conf config file as follows...

ErrorLog "/var/log/httpd-error.log"

In the httpd-access.log file, I do see my IP address that I browsed from, the timestamp, and the HTTP request method along with the server's response (400 or 404), etc....

50.*.8.*** - - [10/Apr/2020:15:44:33 +0000] "POST /cgi-bin/mainfunction.cgi HTTP/1.1" 400 226 "-" "-"
50.*.8.*** - - [10/Apr/2020:15:45:29 +0000] "POST /cgi-bin/mainfunction.cgi HTTP/1.1" 400 226 "-" "-"
50.*.8.*** - - [10/Apr/2020:15:46:16 +0000] "GET /tsutsfd HTTP/1.1" 400 226 "-" "-"
50.*.8.*** - - [10/Apr/2020:15:47:15 +0000] "GET /JDFADLSFJADf" 404 196 "-" "-"

The http-access.log is configured in the Apache as follows...  

CustomLog "/var/log/httpd-access.log" combined

I've checked for duplicates or another path I might've been specifying for the ErrorLog but there's nothing else. 
I even went as far as changing the 'LogLevel' in that directive do something other than "warn" and restarted Apache, but nothing is showing in the httpd-error.log file related to when I browse for non-existent content.

Fri Apr 10 15:43:03.552152 2020] [core:debug] [pid 58525] protocol.c(1444): [client 50.*.8.***:47286] AH00569: client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /cgi-bin/mainfunction.cgi
[Fri Apr 10 15:44:26.638599 2020] [core:info] [pid 58523] AH00096: removed PID file /var/run/httpd.pid (pid=58523)
[Fri Apr 10 15:44:26.638668 2020] [mpm_prefork:notice] [pid 58523] AH00169: caught SIGTERM, shutting down
[Fri Apr 10 15:44:26.814412 2020] [mpm_prefork:notice] [pid 58573] AH00163: Apache/2.4.43 (FreeBSD) configured -- resuming normal operations
[Fri Apr 10 15:44:26.820077 2020] [core:notice] [pid 58573] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Fri Apr 10 15:45:17.550982 2020] [mpm_prefork:notice] [pid 58573] AH00169: caught SIGTERM, shutting down
[Fri Apr 10 15:45:17.706588 2020] [mpm_prefork:notice] [pid 58613] AH00163: Apache/2.4.43 (FreeBSD) configured -- resuming normal operations
[Fri Apr 10 15:45:17.708654 2020] [core:notice] [pid 58613] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'

As you can see from the httpd-error.log file, there are not errors corresponding to when I tried browsing for a file/resource that doesn't exist.  However, you can where I had changed to the various logging levels and restarted Apache to no avail.  Still nothing.  

I would expect to see errors such as those mentioned about ("File does not exist", etc.) in the error log file.  Am I missing something here?   Or is Apache on FreeBSD functioning as designed?  

Any assistance, pointers or guidance is appreciated.  


Kind Regards,


--Cf
Carltonfsck


----------



## richardtoohey2 (Apr 10, 2020)

My initial thought was it does log the failed requests, but maybe that was Apache 2.2 or something.

I had:


```
LogLevel warn
```

And no errors logged for missing files.

I tried:


```
LogLevel notice
```

Still no errors logged for missings files.

But this worked:


```
LogLevel info
```

Are you definitely restarting Apache after changing the config file?  Not got any include files with different config?

HTH


----------



## carltonfsck (Apr 10, 2020)

richardtoohey2 said:


> My initial thought was it does log the failed requests, but maybe that was Apache 2.2 or something.
> 
> I had:
> 
> ...



Hey richardtoohey2...

Thank you for your feedback! 

Yes, I restarted Apache several different ways after making the modifications to httpd.conf...

$ sudo service apache24 restart
$ sudo service apache24 graceful 
$ sudo apachectl restart
$ sudo apachectl graceful 

However, still nothing in the /httpd-error.log file, just the /httpd-access.log file.  
I even went back and set LogLevel to 'info' as you had done and still nothing.  

My Apache install is recent and doesn't have much to it in terms of configuration.  It's barebones at best.  I just configured the basics with no mod_ssl, no other includes (that I'm aware of).

I'm really at a loss here.  I'm wondering if there was a change in Apache24 that only logs to the /httpd-access.log file?  
My previous FreeBSD installs that had Apache (v10+), I recall having no issues and the errors logged to /httpd-error.log.   

Regards,
--Cf
Carltonfsck


----------



## jmos (Apr 10, 2020)

As far as I understand a 404 is just not an "error" anymore. Take a look here:








						404 error doesn't appear in Apache error.log
					

If a visitor gets 404 error, nothing is written in apache error.log. In access log it appears like this:  GET /qqq HTTP/1.1" 404 409 "-" And nothing in error.log. I have tried everything about Log...




					stackoverflow.com


----------



## carltonfsck (Apr 10, 2020)

Breaking News,

Looks like it's working now.  Apparently setting the LogLevel to 'info', THEN issuing the 'sudo apachectl graceful' did it.  Something I didn't do before with all the various others combinations of restart that I tried to with Apache.  

Thank you for turning the light on in my head and making me realize to use another way to restart Apache ( 'apachectl graceful.' ).  

This case is CLOSED!  


Regards,

--Cf
Carltonfsck


----------

