logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Error logs
Author
nerak99



Joined: 22 Apr 2016
Posts: 1
Location: Nottingham

PostPosted: Fri 22 Apr '16 14:31    Post subject: Error logs Reply with quote

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

PostPosted: Sun 24 Apr '16 17:27    Post subject: Reply with quote

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

PostPosted: Sun 24 Apr '16 17:37    Post subject: Reply with quote

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

PostPosted: Sun 24 Apr '16 17:45    Post subject: Reply with quote

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

PostPosted: Sun 24 Apr '16 18:44    Post subject: Reply with quote

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

PostPosted: Mon 25 Apr '16 15:12    Post subject: Reply with quote

I've asked that on the docs mailing list[1]

The answer is so use info as loglevel to have the 404s in the error log again.



[1] http://marc.info/?l=apache-docs&m=146152863021580&w=2
Back to top


Reply to topic   Topic: Error logs View previous topic :: View next topic
Post new topic   Forum Index -> Apache