Log Files

Appweb provides detailed logging regarding client accesses and the operation of Appweb. This is done via two log files:

This document describes the two logs and the information available in each log.

Error Log

The Error Log records the essential Appweb configuration, details of denied requests, and other trace and error information. The location of the Error Log file is specified by the ErrorLog configuration file directive. The ErrorLog directive can also specify the maximum log file size, the number of backup log files to keep and whether to truncate the log file when Appweb is restarted.

The ErrorLog directive can also specify the verbosity level with which to write to the log. The log level is a digit ranging from 0 (the least verbose) to 9 (the most verbose). For example, if you set the log level to 2, messages at levels 0 and 1 will be output to the log. Level 0 will only record errors. Level 2 is the default and will record denied accesses. Levels 3-9 will record various internal Appweb activities. You should be careful with levels above 4 as the error log can grow very large with high log levels.

ErrorLog error.log level=2 backup=5 stamp=1hr

Logging Requests

The error log can also record detailed request information that is useful for debugging. The Log directive controls which parts of a request will be traced to the error log.

Log rx conn=5 first=2 headers=3 body=5 size=10K exclude="jpg,gif,png"

This directive will cause requests to be traced to the error log. New connections will be emitted at level 5, the first line of the request at level 2, request headers at level 3 and the request body data at level 5. Trace will be a maximum of 10K per request and graphic requests will be excluded.

Log tx first=3 headers=3 body=5 time=6 size=10K exclude="jpg,gif,png"

This directive will cause responses to be traced to the error log.

Sample Output

Here is a sample error log. Some lines have been manually wrapped to fit on the page.

appweb: 2: Configuration for Embedthis Appweb
appweb: 2: ---------------------------------------------
appweb: 2: Version:            4.0.0-B2
appweb: 2: BuildType:          Debug
appweb: 2: CPU:                x64
appweb: 2: OS:                 macosx
appweb: 2: Host:               sunny.local
appweb: 2: Directory:          /Users/guest/git/appweb/src/server
appweb: 2: Configure:          me -q -configure . -debug
appweb: 2: ---------------------------------------------
appweb: 2: Config File /Users/guest/git/appweb/src/server/appweb.conf
appweb: 2: Set server root to: "/Users/guest/git/appweb/src/server"
appweb: 2: Server Root "."
appweb: 2: Loading native module cgiHandler
appweb: 2: Loading native module espHandler
appweb: 2: Loading native module sslModule
appweb: 2: Started HTTP  service on "*:80"
appweb: 1: HTTP services Started at Wed May 23 17:39:10 2014 PDT with max 10
           threads

Each line in the error log is prefixed with source information. This follows the format:

program:logLevel

The log level is the verbosity level assigned to the trace information by Appweb.

The error log always contains a header detailing the high level Appweb configuration. It specifies what version of Appweb is being run, what handlers and modules are loaded, and what IP addresses are being listened to.

You may also specify the error log file and log level via the Appweb command line "--log" option. If you invoke Appweb with a "--log logSpec" command line option, it will override the ErrorLog and LogLevel directives.

Access Log

The Access Log records the details of each successful request served by Appweb. The access log file format is configurable and can log requests in a variety of formats. By default, it will log in the Combined Log File Format that is used by the Apache web server. The location of the access log file and its format is specified via the CustomLog configuration file directive.

The access log file is parsable by many open source and commercial log file analyzers. Here is a sample access log. Some lines have been manually wrapped to fit on the page.

localhost - - [Fri Dec 19 16:08:13 2003] "GET / 
        HTTP/1.1" 302 464
localhost - - [Fri Dec 19 16:08:22 2003] "GET /doc/index.html 
        HTTP/1.1" 200 8006
localhost - - [Fri Dec 19 16:08:22 2003] "GET /doc/css/doc.css 
        HTTP/1.1" 200 10588
localhost - - [Fri Dec 19 16:08:22 2003] "GET /doc/images/backLeft.png 
        HTTP/1.1" 200 16492
localhost - - [Fri Dec 19 16:08:22 2003] "GET /doc/images/backMiddle.png 
        HTTP/1.1" 200 464
localhost - - [Fri Dec 19 16:08:22 2003] "GET /doc/images/backRight.png 
        HTTP/1.1" 200 987
localhost - - [Fri Dec 19 16:08:22 2003] "GET /doc/images/graybar.gif 
        HTTP/1.1" 200 290
localhost - - [Fri Dec 19 16:08:24 2003] "GET /doc/index.html 
        HTTP/1.1" 304 167
localhost - - [Fri Dec 19 16:08:24 2003] "GET /doc/css/doc.css 
        HTTP/1.1" 304 167
localhost - - [Fri Dec 19 16:08:24 2003] "GET /doc/images/backLeft.png 
        HTTP/1.1" 304 167
localhost - - [Fri Dec 19 16:08:24 2003] "GET /doc/images/backMiddle.png 
        HTTP/1.1" 304 165
localhost - - [Fri Dec 19 16:08:24 2003] "GET /doc/images/backRight.png 
        HTTP/1.1" 304 166

© Embedthis Software. All rights reserved.