zhxy/http服务器/appweb-4.3.4-0/doc/guide/appweb/users/logFiles.html

201 lines
11 KiB
HTML

<!-- BeginDsi "dsi/head.html" -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Embedthis Appweb 4.3.4 Documentation</title>
<meta name="keywords" content="embedded web server, web server software, embedded HTTP, application web server,
embedded server, small web server, HTTP server, library web server, library HTTP, HTTP library" />
<meta name="description" content="Embedthis Sofware provides commercial and open source embedded web servers for
devices and applications." />
<meta name="robots" content="index,follow" />
<link href="../../../doc.css" rel="stylesheet" type="text/css" />
<link href="../../../print.css" rel="stylesheet" type="text/css" media="print"/>
<!--[if IE]>
<link href="../../../iehacks.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="http://www.google.com/cse/style/look/default.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="top">
<a class="logo" href="http://appwebserver.org/">&nbsp;</a>
<div class="topRight">
<div class="search">
<div id="cse-search-form"></div>
<div class="version">Embedthis Appweb 4.3.4</div>
</div>
</div>
<div class="crumbs">
<a href="../../../index.html">Home</a>
<!-- EndDsi -->
&gt; <a href="index.html">Users Guide</a> &gt; <b>Log Files</b>
</div>
</div>
<div class="content">
<div class="contentRight">
<h1>Quick Nav</h1>
<ul class="nav">
<li><a href="#errorLog">Error Log</a></li>
<li><a href="#accessLog">Access Log</a></li>
</ul>
<!-- BeginDsi "dsi/usersGuideSeeAlso.html" -->
<h1>See Also</h1>
<ul class="nav">
<li><a href="../../../guide/appweb/users/index.html">User Guide Overview</a></li>
<li><a href="../../../guide/appweb/users/configuration.html">Configuring Appweb</a></li>
<li><a href="../../../guide/appweb/users/ports.html">Ports and Binding</a></li>
<li><a href="../../../guide/appweb/users/lang.html">Multi-Language Support</a></li>
<li><a href="../../../guide/appweb/users/authentication.html">User Authorization</a></li>
<li><a href="../../../guide/appweb/users/logFiles.html">Log Files</a></li>
<li><a href="../../../guide/appweb/users/vhosts.html">Virtual Hosts</a></li>
<li><a href="../../../guide/appweb/users/security.html">Security Considerations</a></li>
<li><a href="../../../guide/appweb/users/ssl.html">SSL</a></li>
<li><a href="../../../guide/appweb/users/modules.html">Appweb Modules</a></li>
<li><a href="../../../guide/appweb/users/stages.html">Pipeline Stages</a></li>
<li><a href="../../../guide/appweb/users/client.html">HTTP Client</a></li>
<li><a href="../../../guide/appweb/users/webSockets.html">WebSockets</a></li>
<li><a href="../../../guide/appweb/users/frameworks.html">Web Frameworks</a></li>
<li><a href="../../../ref/appweb/architecture.html">Appweb Architecture</a></li>
</ul>
<!-- EndDsi -->
</div>
<div class="contentLeft">
<h1>Log Files</h1>
<p>Appweb provides detailed logging regarding client accesses and the operation of Appweb. This is done via two
log files:</p>
<ul>
<li>Error Log</li>
<li>Access Log</li>
</ul>
<p>This document describes the two logs and the information available in each log.</p>
<a id="errorLog"></a>
<h2 class="section">Error Log</h2>
<p>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
<a href="dir/log.html#errorLog">ErrorLog</a>
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 append or truncate the log file when Appweb is
restarted. </p>
<p>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.</p>
<pre>ErrorLog error.log level=2 backup=5 append stamp=1hr</pre>
<h3>Logging Requests</h3>
<p>The error log can also record detailed request information that is useful for debugging. The
<a href="dir/log.html#log">Log</a> directive controls which parts of a request will be traced to the error
log.</p>
<pre>Log rx conn=5 first=2 headers=3 body=5 size=10K exclude="jpg,gif,png"</pre>
<p>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.</p>
<pre>Log tx first=3 headers=3 body=5 time=6 size=10K exclude="jpg,gif,png"</pre>
<p>This directive will cause responses to be traced to the error log.</p>
<h3>Sample Output</h3>
<p>Here is a sample error log. Some lines have been manually wrapped to fit on the page.</p>
<pre>
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: bit -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 phpHandler
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 2013 PDT with max 10
threads
</pre>
<p>Each line in the error log is prefixed with source information. This follows the format:</p>
<pre>
program:logLevel
</pre>
<p>The log level is the verbosity level assigned to the trace information by Appweb.</p>
<p>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.</p>
<p>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.</p>
<a id="accessLog"></a>
<h2>Access Log</h2>
<p>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 <a href="dir/log.html#customLog">CustomLog</a> configuration file
directive.</p>
<p>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.</p>
<pre>
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
</pre>
</div>
</div>
<!-- BeginDsi "dsi/bottom.html" -->
<div class="bottom">
<p class="footnote">
<a href="../../../product/copyright.html" >&copy; Embedthis Software LLC, 2003-2013.
All rights reserved. Embedthis, Appweb, ESP, Ejscript and Embedthis GoAhead are trademarks of Embedthis Software LLC.</a>
</p>
</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en'});
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl(
'000262706376373952077:1hs0lhenihk');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchboxOnly("http://appwebserver.org/search.html");
customSearchControl.draw('cse-search-form', options);
}, true);
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-179169-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>