Recipe 3.2 Getting More Detailed Errors
Problem
You want more information in the error log in order to debug a
problem.
Solution
Change (or add) the LogLevel line in your
httpd.conf file. There are several possible
arguments, which are enumerated below:
For example:
LogLevel Debug
Discussion
There are several hierarchical levels of error logging available,
each identified by its own keyword. The default value of
LogLevel is warn. Listed in
descending order of importance, the possible values are:
- emerg
-
Emergencies; web server is unusable
- alert
-
Action must be taken immediately
- crit
-
Critical conditions
- error
-
Error conditions
- warn
-
Warning conditions
- notice
-
Normal but significant condition
- info
-
Informational
- debug
-
Debug-level messages
emerg results in the least information being
recorded and debug in the most. However, at
debug level a lot of information will probably be
recorded that is unrelated to the issue you're
investigating, so it's a good idea to revert to the
previous setting when the problem is solved.
Even though the various logging levels are hierarchical in nature,
one oddity is that notice level messages are
always logged regardless of the setting of the
LogLevel directive.
The severity levels are rather loosely defined and even more loosely
applied. In other words, the severity at which a particular error
condition gets logged is decided at the discretion of the developer
who wrote the code—your opinion may differ.
Here are some sample messages of various severities:
[Thu Apr 18 01:37:40 2002] [alert] [client 64.152.75.26] /home/smith/public_html/
test/.htaccess: Invalid command 'Test', perhaps mis-spelled or defined by a
module not included in the server configuration
[Thu Apr 25 22:21:58 2002] [error] PHP Fatal error: Call to undefined function:
decode_url( ) in /usr/apache/htdocs/foo.php on line 8
[Mon Apr 15 09:31:37 2002] [warn] pid file /usr/apache/logs/httpd.pid overwritten --
Unclean shutdown of previous Apache run?
[Mon Apr 15 09:31:38 2002] [info] Server built: Apr 12 2002 09:14:06
[Mon Apr 15 09:31:38 2002] [notice] Accept mutex: sysvsem (Default: sysvsem)
These are fairly normal messages that you might encounter on a
production web server. If you set the logging level to
Debug, however, you might see many more messages of
cryptic import, such as:
[Thu Mar 28 10:29:50 2002] [debug] proxy_cache.c(992): No CacheRoot, so no caching.
Declining.
[Thu Mar 28 10:29:50 2002] [debug] proxy_http.c(540): Content-Type: text/html
These are exactly what they seem to be: debugging messages intended
to help an Apache developer figure out what the proxy module is
doing.
See Also
At the time of this writing, there is an effort underway to provide a
dictionary of Apache error messages, what they mean, and what to do
about the conditions they report, but it doesn't
have anything concrete to show at this point. When it does, it should
be announced at the Apache server developer site:
- http://httpd.apache.org/dev/
It will be mentioned on this book's companion web
site, as well:
- http://Apache-Cookbook.Com/
In addition, see the detailed documentation of the
LogLevel
directive at the Apache site:
- http://httpd.apache.org/docs/mod/core.html#loglevel
|