Author |
|
nerak99
Joined: 22 Apr 2016 Posts: 1 Location: Nottingham
|
Posted: Fri 22 Apr '16 14:31 Post subject: Error logs |
|
|
I am trying to work out a mystery redirect that is occurring between two site on my server.
When I try to monitor the logs, I see accesses in the other_vhosts_access.log but the redirect I am trying to monitor does not trigger anything in there.
However, the error.log in /var/log/apache2/error.log is not showing any change even if I deliberately make an error by going to a non existent site.
I think that if I could monitor errors I might get somewhere.
How do I turn on the error log? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sun 24 Apr '16 17:27 Post subject: |
|
|
In each vhost you have to define an access log and and an error log.
e.g.
Code: |
<VirtualHost *:80>
ServerName example.com
ErrorLog /var/log/apache2/example_error.log
LogLevel warn
CustomLog /opt/apache2/logs/example_access.log combined
</VirtualHost>
|
|
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sun 24 Apr '16 17:37 Post subject: |
|
|
Note: in Apache 2.4, 404 errors are not logged. It is the only thing I do not like about 2.4. It was done so error logs would not be polluted with missing favicon.ico files. LogLevel debug sometimes helps.
You may need LogLevel debug to figure out your redirection problem. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sun 24 Apr '16 17:45 Post subject: |
|
|
glsmith wrote: | Note: in Apache 2.4, 404 errors are not logged. |
The 404s are in the access log. ( i forgot that in my previous post). Howver is is true that they are no longer in the error log. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sun 24 Apr '16 18:44 Post subject: |
|
|
Yes they are as they were in 2.2. The problem is they do not tell you where in the file system Apache is looking for the file like the error log in Apache < 2.4 did. That info has helped me figure out many 404's in the past quickly. Now it's a mystery that has to be hunted down and can be very time consuming.
This really doesn't help much
::1 - - [24/Apr/2016:09:07:09 -0700] "GET /locked/secure.php HTTP/1.1" 404 215
/locked/ is an Alias to /home/secured/, I can see the file there so why is it 404ing?
Now this error message gives me a good hint
[Sun Apr 24 09:37:29 2016] [error] [client 127.0.0.1] File does not exist: C:/home/secure/secure.php
Oops ... typo in config, missing the 'd' in secured
It looks like they've ruined 2.2 as well now trying this on 2.2.31, I used 2.2.14 to get this IMO useful error message. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|