summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mod_log_debug.xml
blob: d4f629dbaf97dc9404ed39110cada86d2e77c51c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mod_log_debug.xml.meta">

<name>mod_log_debug</name>
<description>Additional configurable debug logging</description>
<status>Experimental</status>
<sourcefile>mod_log_debug.c</sourcefile>
<identifier>log_debug_module</identifier>
<compatibility>Available in Apache 2.3.14 and later</compatibility>

<section id="examples"><title>Examples</title>

    <ol>
      <li>
        Log message after request to /foo/* is processed:

        <example>
            &lt;Location /foo&gt;<br/>
            &nbsp;&nbsp;LogMessage "/foo has been requested"<br/>
            &lt;/Location&gt;<br/>
        </example>
      </li>

      <li>
        Log message if request to /foo/* is processed in a sub-request:
        <example>
            &lt;Location /foo&gt;<br/>
            &nbsp;&nbsp;LogMessage "subrequest to /foo" hook=type_checker if=%{IS_SUBREQ}<br/>
            &lt;/Location&gt;<br/>
        </example>

        The default log_transaction hook is not executed for sub-requests,
        therefore we have to use a different hook.
      </li>


      <li>
        Log message if an IPv6 client causes a request timeout:
        <example>
            LogMessage "IPv6 timeout from %{REMOTE_ADDR}"
              "if=-T %{IPV6} &amp;&amp; %{REQUEST_STATUS} = 408"
        </example>
        Note the placing of the dobule quotes for the <code>if=</code> argument.
      </li>

      <li>
        Log the value of the "X-Foo" request environment variable in each
        stage of the request:
        <example>
            &lt;Location /&gt;<br/>
            &nbsp;&nbsp;LogMessage "%{reqenv:X-Foo}" hook=all<br/>
            &lt;/Location&gt;<br/>
        </example>
        Together with the microsecond time stamps in the error log, this
        allows to determine the times spent in the different parts of the
        request processing.
      </li>

    </ol>
</section>

<directivesynopsis>
<name>LogMessage</name>
<description>Log userdefined message to error log
</description>
<syntax>LogMessage <var>message</var>
[hook=<var>hook</var>] [if=<var>expression</var>]
</syntax>
<default>Unset</default>
<contextlist><context>directory</context>
</contextlist>

<usage>
    <p>This directive causes a user defined message to be logged to the
    error log. The message can use variables and functions from the
    <a href="../expr.html">ap_expr syntax</a>. The messages are logged at
    loglevel info.</p>

    <p>The hook specifies before which phase of request procesing the message
    will be logged. The following hooks are supported:</p>

    <table border="1" style="zebra">
    <columnspec><column width="1"/></columnspec>
    <tr><th>Name</th></tr>
    <tr><td><code>translate_name</code></td></tr>
    <tr><td><code>type_checker</code></td></tr>
    <tr><td><code>quick_handler</code></td></tr>
    <tr><td><code>map_to_storage</code></td></tr>
    <tr><td><code>check_access</code></td></tr>
    <tr><td><code>check_access_ex</code></td></tr>
    <tr><td><code>insert_filter</code></td></tr>
    <tr><td><code>check_authn</code></td></tr>
    <tr><td><code>check_authz</code></td></tr>
    <tr><td><code>fixups</code></td></tr>
    <tr><td><code>handler</code></td></tr>
    <tr><td><code>log_transaction</code></td></tr>
    </table>

    <p>The default is <code>log_transaction</code>. The special value
    <code>all</code> is also supported, causing a message to be logged at each
    phase. Not all hooks are executed for every request.</p>

    <p>The optional expression allows to restrict the message if a
    condition is met. The details of the expression syntax are described in
    the <a href="../expr.html">ap_expr documentation</a>.</p>

</usage>

</directivesynopsis>

</modulesynopsis>