Apache
  Home arrow Apache arrow Page 2 - Getting Started with Apache 2.0 Part I...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
APACHE

Getting Started with Apache 2.0 Part II
By: Harish Kamath
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 13
    2005-03-21

    Table of Contents:
  • Getting Started with Apache 2.0 Part II
  • The Apache Log Files
  • Who Are You?
  • One Server, One Hundred Websites

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Getting Started with Apache 2.0 Part II - The Apache Log Files


    (Page 2 of 4 )

    You've probably read (or heard) the fairy tale in which Hansel and Gretel left breadcrumbs to find their way back home. But, what on earth does this bedtime story have to do with the topic that I am currently discussing - the Apache log files?

    Frankly, not much!

    To be honest, it was an attempt to highlight the similar purpose of two diverse actions: the breadcrumbs dropped by the two characters in the fairy tale and the log files generated by the Apache Web server. The former ensures that the children (in the story) were able to return home safely after their escape and the latter allows a webmaster to learn more about the visitors based on the data (i.e. breadcrumbs) left behind after every visit to the website. And if that’s not enough, the error log files can help developers resolve nasty errors that occur on the server.

    Generally speaking, Apache can be configured to generate two types of log files. The first records every request made to the Web server and the second logs all the errors encountered by the Web server such as the infamous "404 - File Not Found" error or the notorious "500 - Internal Server Error" and many more!

    By default, the Apache Web server is configured to generate several versions of these log files, but only two are active when you start it for the first time. In order to give you a better picture, allow me to explain the first log-related configuration directive from the "http.conf" file:

    ErrorLog logs/error_log

    As the name suggests, the "ErrorLog" directive allows you to specify the name of the "error" log file. This path can either be relative to the server root (as above) or represent the absolute path to the file on your system. Note that the default name (of the log file) will vary with the OS platform that you use; you can always modify it here.

    Now, let us take a peek at the contents of the error log file generated by my local Apache instance:

    [Sat Dec 18 15:11:54 2004] [error] [client 127.0.0.1] request failed: error reading the headers
    [Sat Dec 18 15:15:34 2004] [error] [client 127.0.0.1] File does not exist: /usr/local/apache/htdocs/library/styles.css

    Now let's decipher these entries. The first value represents the date and time the error occurred, the second indicates the "error level" of the current entry (more on this later), the third column is the IP address of the client machine and finally, we have a message that attempts to describe the nature of the error. Note that the system location of the file, instead of its web path, is written into the log file.

    The next directive de-mystifies the "error level" term used above. Aptly named "LogLevel," it can be assigned any one value from a pre-defined list and allows you to control the errors (based on their severity) that you wish to record in your "error" log file. Take a look:

    #
    # LogLevel: Control the number of messages logged to the
    # error.log.
    # Possible values include: debug, info, notice, warn,
    # error, crit, alert, emerg.
    #
    LogLevel warn

    I have deliberately copied the comments that precede this directive in the configuration file - you'll notice that they list the different values that you assign to the "LogLevel" directive. There is no doubt that the names of different error levels give a good indication of the nature of errors to be recorded for each level. It is generally recommended that you set this value to "debug" on development servers and to "error" on production ones.

    For complete information on all of the error levels listed above, you can review the official Apache documentation at: http://httpd.apache.org/docs-2.0/mod/core.html#loglevel

    Here's a little tip (excerpted from the official documentation) before we move to the next section: you can use the following command on most *NIX systems to monitor your error log file on a continuous basis:

    $ tail -f /usr/local/apache/logs/error_log

    More Apache Articles
    More By Harish Kamath


       · hi i am seting up a multi site this is the warning that i get when is set up my...
     

       

    APACHE ARTICLES

    - Creating a VAMP (Vista, Apache, MySQL, PHP) ...
    - Putting Apache in Jail
    - Containing Intrusions in Apache
    - Server Limits for Apache Security
    - Setting Permissions in Apache
    - Installing Apache
    - Apache Installation and Configuration
    - Apache Tapestry and Custom Components: DateI...
    - Tapestry and AJAX: Autocompleter and InlineE...
    - PropertySelection and IPropertySelectionMode...
    - The DatePicker and Shell Components of Apach...
    - Apache Tapestry: ASO and More Components
    - Apache Tapestry and DirectLink, IoC and DI
    - Making a CelebrityCollector with Apache Tape...
    - Apache Tapestry and Listener Methods, Condit...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway