~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/sasl/doc/src/error_logging.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE chapter SYSTEM "chapter.dtd">
 
3
 
 
4
<chapter>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>1997</year>
 
8
      <year>2007</year>
 
9
      <holder>Ericsson AB, All Rights Reserved</holder>
 
10
    </copyright>
 
11
    <legalnotice>
 
12
  The contents of this file are subject to the Erlang Public License,
 
13
  Version 1.1, (the "License"); you may not use this file except in
 
14
  compliance with the License. You should have received a copy of the
 
15
  Erlang Public License along with this software. If not, it can be
 
16
  retrieved online at http://www.erlang.org/.
 
17
 
 
18
  Software distributed under the License is distributed on an "AS IS"
 
19
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
20
  the License for the specific language governing rights and limitations
 
21
  under the License.
 
22
 
 
23
  The Initial Developer of the Original Code is Ericsson AB.
 
24
    </legalnotice>
 
25
 
 
26
    <title>SASL Error Logging</title>
 
27
    <prepared>Magnus Fr&ouml;berg</prepared>
 
28
    <responsible>Bjarne D&auml;cker</responsible>
 
29
    <docno></docno>
 
30
    <approved></approved>
 
31
    <checked></checked>
 
32
    <date>1999-04-13</date>
 
33
    <rev>B</rev>
 
34
    <file>error_logging.sgml</file>
 
35
  </header>
 
36
  <p>The SASL application introduces three types of reports:</p>
 
37
  <list type="bulleted">
 
38
    <item>supervisor report</item>
 
39
    <item>progress report</item>
 
40
    <item>crash report.</item>
 
41
  </list>
 
42
  <p>When the SASL application is started, it adds a handler that 
 
43
    formats and writes these reports, as specified in the
 
44
    configuration parameters for sasl, i.e the environment variables
 
45
    in the SASL application specification, which is found in the 
 
46
    <c>.app</c> file of SASL. See 
 
47
    <seealso marker="sasl_app">sasl(Application)</seealso>, and  app(File) 
 
48
    in the Kernel Reference Manual
 
49
    for the details.</p>
 
50
 
 
51
  <section>
 
52
    <title>Supervisor Report</title>
 
53
    <p>A supervisor report is issued when a supervised child terminates in
 
54
      an unexpected way. A supervisor report contains the following
 
55
      items:</p>
 
56
    <taglist>
 
57
      <tag>Supervisor.</tag>
 
58
      <item>The name of the reporting supervisor.</item>
 
59
      <tag>Context.</tag>
 
60
      <item>Indicates in which phase the child terminated
 
61
       from the supervisor's point of view. This can be
 
62
      <c>start_error</c>, <c>child_terminated</c>, or
 
63
      <c>shutdown_error</c>.</item>
 
64
      <tag>Reason.</tag>
 
65
      <item>The termination reason.</item>
 
66
      <tag>Offender.</tag>
 
67
      <item>The start specification for the child.</item>
 
68
    </taglist>
 
69
  </section>
 
70
 
 
71
  <section>
 
72
    <title>Progress Report</title>
 
73
    <p>A progress report is issued whenever a supervisor starts or
 
74
      restarts. A progress report contains the following items:</p>
 
75
    <taglist>
 
76
      <tag>Supervisor.</tag>
 
77
      <item>The name of the reporting supervisor.</item>
 
78
      <tag>Started.</tag>
 
79
      <item>The start specification for the successfully
 
80
       started child.</item>
 
81
    </taglist>
 
82
    <marker id="CRASH"></marker>
 
83
  </section>
 
84
 
 
85
  <section>
 
86
    <title>Crash Report</title>
 
87
    <p>Processes started with the <c>proc_lib:spawn</c> or
 
88
      <c>proc_lib:spawn_link</c> functions are wrapped within a
 
89
      <c>catch</c>. A crash report is issued whenever such a process
 
90
      terminates with an unexpected reason, which is any reason other
 
91
      than <c>normal</c> or <c>shutdown</c>. Processes using the
 
92
      <c>gen_server</c> and <c>gen_fsm</c> behaviours are examples of
 
93
      such processes. A crash report contains the following items:</p>
 
94
    <taglist>
 
95
      <tag>Crasher.</tag>
 
96
      <item>Information about the crashing process is reported, such
 
97
       as initial function call, exit reason, and message queue.</item>
 
98
      <tag>Neighbours.</tag>
 
99
      <item>Information about processes which are linked to the crashing
 
100
       process and do not trap exits. These processes are the
 
101
       neighbours which will terminate because of this process
 
102
       crash. The information gathered is the same as the information
 
103
       for Crasher, shown in the previous item.</item>
 
104
    </taglist>
 
105
 
 
106
    <section>
 
107
      <title>An Example</title>
 
108
      <p>The following example shows the reports which are generated
 
109
        when a process crashes. The example process is an
 
110
        <c>permanent</c> process supervised by the <c>test_sup</c>
 
111
        supervisor. A division by zero is executed and the error is
 
112
        first reported by the faulty process. A crash report is
 
113
        generated as the process was started using the
 
114
        <c>proc_lib:spawn/3</c> function. The supervisor generates a
 
115
        supervisor report showing the process that has crashed, and then a
 
116
        progress report is generated when the process is finally
 
117
        re-started.</p>
 
118
      <pre>
 
119
\011=ERROR REPORT==== 27-May-1996::13:38:56 ===
 
120
\011&lt;0.63.0>: Divide by zero !
 
121
\011
 
122
\011=CRASH REPORT==== 27-May-1996::13:38:56 ===
 
123
\011crasher:
 
124
\011pid: &lt;0.63.0>
 
125
\011registered_name: []
 
126
\011error_info: {badarith,{test,s,[]}}
 
127
\011initial_call: {test,s,[]}
 
128
\011ancestors: [test_sup,&lt;0.46.0>]
 
129
\011messages: []
 
130
\011links: [&lt;0.47.0>]
 
131
\011dictionary: []
 
132
\011trap_exit: false
 
133
\011status: running
 
134
\011heap_size: 128
 
135
\011stack_size: 128
 
136
\011reductions: 348
 
137
\011neighbours:
 
138
\011
 
139
\011=SUPERVISOR REPORT==== 27-May-1996::13:38:56 ===
 
140
\011Supervisor: {local,test_sup}
 
141
\011Context:    child_terminated
 
142
\011Reason:     {badarith,{test,s,[]}}
 
143
\011Offender:   [{pid,&lt;0.63.0>},
 
144
\011{name,test},
 
145
\011{mfa,{test,t,[]}},
 
146
\011{restart_type,permanent},
 
147
\011{shutdown,200},
 
148
\011{child_type,worker}]
 
149
\011
 
150
\011
 
151
\011=PROGRESS REPORT==== 27-May-1996::13:38:56 ===
 
152
\011Supervisor: {local,test_sup}
 
153
\011Started:  [{pid,&lt;0.64.0>},
 
154
\011{name,test},
 
155
\011{mfa,{test,t,[]}},
 
156
\011{restart_type,permanent},
 
157
\011{shutdown,200},
 
158
\011{child_type,worker}]
 
159
      </pre>
 
160
    </section>
 
161
  </section>
 
162
 
 
163
  <section>
 
164
    <title>Multi-File Error Report Logging</title>
 
165
    <p>Multi-file error report logging is used to store error messages,
 
166
      which are received by the <c>error_logger</c>. The error messages
 
167
      are stored in several files and each file is smaller than a
 
168
      specified amount of kilobytes, and no more than a specified number
 
169
      of files exist at the same time. The logging is very fast because
 
170
      each error message is written as a binary term.</p>
 
171
    <p>Refer to
 
172
      <c>sasl</c> application in the Reference Manual for more details.</p>
 
173
  </section>
 
174
 
 
175
  <section>
 
176
    <title>Report Browser</title>
 
177
    <p>The report browser is used to browse and format error reports
 
178
      written by the error logger handler <c>error_logger_mf_h</c>.</p>
 
179
    <p>The <c>error_logger_mf_h</c> handler writes all reports to a
 
180
      report logging directory. This directory is specified when
 
181
      configuring the SASL application.</p>
 
182
    <p>If the report browser is
 
183
      used off-line, the reports can be copied to another directory
 
184
      which is specified when starting the browser. If no such directory
 
185
      is specified, the browser reads reports from the SASL
 
186
      <c>error_logger_mf_dir</c>.</p>
 
187
 
 
188
    <section>
 
189
      <title>Starting the Report Browser</title>
 
190
      <p>Start the <c>rb_server</c> with the function
 
191
        <c>rb:start([Options])</c> as shown in the following
 
192
        example:</p>
 
193
      <pre>
 
194
 
 
195
\0115><input>rb:start([{max, 20}]).</input>
 
196
\011rb: reading report...done.
 
197
\011rb: reading report...done.
 
198
\011rb: reading report...done.
 
199
\011rb: reading report...done.
 
200
      </pre>
 
201
    </section>
 
202
 
 
203
    <section>
 
204
      <title>On-line Help</title>
 
205
      <p>Enter the command <em>rb:help().</em> to access the report
 
206
        browser on-line help system.</p>
 
207
    </section>
 
208
 
 
209
    <section>
 
210
      <title>List Reports in the Server</title>
 
211
      <p>The function <c>rb:list()</c> lists all loaded reports:</p>
 
212
      <pre>
 
213
 
 
214
\0114><input>rb:list().</input>
 
215
\011No                Type          Process       Date     Time
 
216
\011==                ====          =======       ====     ====
 
217
\01120            progress         &lt;0.17.0> 1996-10-16 16:14:54
 
218
\01119            progress         &lt;0.14.0> 1996-10-16 16:14:55
 
219
\01118               error         &lt;0.15.0> 1996-10-16 16:15:02
 
220
\01117            progress         &lt;0.14.0> 1996-10-16 16:15:06
 
221
\01116            progress         &lt;0.38.0> 1996-10-16 16:15:12
 
222
\01115            progress         &lt;0.17.0> 1996-10-16 16:16:14
 
223
\01114            progress         &lt;0.17.0> 1996-10-16 16:16:14
 
224
\01113            progress         &lt;0.17.0> 1996-10-16 16:16:14
 
225
\01112            progress         &lt;0.14.0> 1996-10-16 16:16:14
 
226
\01111               error         &lt;0.17.0> 1996-10-16 16:16:21
 
227
\01110               error         &lt;0.17.0> 1996-10-16 16:16:21
 
228
\0119        crash_report  release_handler 1996-10-16 16:16:21
 
229
\0118   supervisor_report         &lt;0.17.0> 1996-10-16 16:16:21
 
230
\0117            progress         &lt;0.17.0> 1996-10-16 16:16:21
 
231
\0116            progress         &lt;0.17.0> 1996-10-16 16:16:36
 
232
\0115            progress         &lt;0.17.0> 1996-10-16 16:16:36
 
233
\0114            progress         &lt;0.17.0> 1996-10-16 16:16:36
 
234
\0113            progress         &lt;0.14.0> 1996-10-16 16:16:36
 
235
\0112               error         &lt;0.15.0> 1996-10-16 16:17:04
 
236
\0111            progress         &lt;0.14.0> 1996-10-16 16:17:09
 
237
\011ok
 
238
      </pre>
 
239
    </section>
 
240
 
 
241
    <section>
 
242
      <title>Show Reports</title>
 
243
      <p>To show details of a specific report, use the function
 
244
        <c>rb:show(Number)</c>:</p>
 
245
      <pre>
 
246
 
 
247
10> <input>rb:show(1).</input>
 
248
7> <input>rb:show(4).</input>
 
249
\011
 
250
PROGRESS REPORT  &lt;0.20.0>                                   1996-10-16 16:16:36
 
251
===============================================================================
 
252
supervisor                                                     {local,sasl_sup}
 
253
started
 
254
[{pid,&lt;0.24.0>},
 
255
{name,release_handler},
 
256
{mfa,{release_handler,start_link,[]}},
 
257
{restart_type,permanent},
 
258
{shutdown,2000},
 
259
{child_type,worker}]
 
260
\011
 
261
ok
 
262
8> rb:show(9).
 
263
\011
 
264
CRASH REPORT  &lt;0.24.0>                                      1996-10-16 16:16:21
 
265
===============================================================================
 
266
Crashing process                                                               
 
267
pid                                                                 &lt;0.24.0>
 
268
registered_name                                              release_handler
 
269
error_info                             {undef,{release_handler,mbj_func,[]}}
 
270
initial_call
 
271
{gen,init_it,
 
272
[gen_server,
 
273
&lt;0.20.0>,
 
274
&lt;0.20.0>,
 
275
{erlang,register},
 
276
release_handler,
 
277
release_handler,
 
278
[],
 
279
[]]}
 
280
ancestors                                                [sasl_sup,&lt;0.18.0>]
 
281
messages                                                                  []
 
282
links                                                    [&lt;0.23.0>,&lt;0.20.0>]
 
283
dictionary                                                                []
 
284
trap_exit                                                              false
 
285
status                                                               running
 
286
heap_size                                                                610
 
287
stack_size                                                               142
 
288
reductions                                                                54
 
289
 
 
290
ok
 
291
      </pre>
 
292
    </section>
 
293
 
 
294
    <section>
 
295
      <title>Search the Reports</title>
 
296
      <p>It is possible to show all reports which contain a common
 
297
        pattern. Suppose a process crashes because it tries to call a
 
298
        non-existing function <c>release_handler:mbj_func.</c> We could
 
299
        then show reports as follows:</p>
 
300
      <pre>
 
301
 
 
302
12><input>rb:grep("mbj_func").</input>          
 
303
Found match in report number 11
 
304
\011
 
305
ERROR REPORT  &lt;0.24.0>                                      1996-10-16 16:16:21
 
306
===============================================================================
 
307
\011
 
308
** undefined function: release_handler:mbj_func[] **
 
309
Found match in report number 10
 
310
 
 
311
ERROR REPORT  &lt;0.24.0>                                      1996-10-16 16:16:21
 
312
===============================================================================
 
313
\011
 
314
** Generic server release_handler terminating 
 
315
** Last message in was {unpack_release,hej}
 
316
** When Server state == {state,[],
 
317
"/home/dup/otp2/otp_beam_sunos5_p1g_7",
 
318
[{release,
 
319
"OTP  APN 181 01",
 
320
"P1G",
 
321
undefined,
 
322
[],
 
323
permanent}],
 
324
undefined}
 
325
** Reason for termination == 
 
326
** {undef,{release_handler,mbj_func,[]}}
 
327
Found match in report number 9
 
328
\011
 
329
CRASH REPORT  &lt;0.24.0>                                      1996-10-16 16:16:21
 
330
===============================================================================
 
331
Crashing process                                                               
 
332
pid                                                                 &lt;0.24.0>
 
333
registered_name                                              release_handler
 
334
error_info                             {undef,{release_handler,mbj_func,[]}}
 
335
initial_call
 
336
{gen,init_it,
 
337
[gen_server,
 
338
&lt;0.20.0>,
 
339
&lt;0.20.0>,
 
340
{erlang,register},
 
341
release_handler,
 
342
release_handler,
 
343
[],
 
344
[]]}
 
345
ancestors                                                [sasl_sup,&lt;0.18.0>]
 
346
messages                                                                  []
 
347
links                                                    [&lt;0.23.0>,&lt;0.20.0>]
 
348
dictionary                                                                []
 
349
trap_exit                                                              false
 
350
status                                                               running
 
351
heap_size                                                                610
 
352
stack_size                                                               142
 
353
reductions                                                                54
 
354
\011
 
355
Found match in report number 8
 
356
\011
 
357
SUPERVISOR REPORT  &lt;0.20.0>                                 1996-10-16 16:16:21
 
358
===============================================================================
 
359
Reporting supervisor                                           {local,sasl_sup}
 
360
\011
 
361
Child process                                                                  
 
362
errorContext                                                child_terminated
 
363
reason                                 {undef,{release_handler,mbj_func,[]}}
 
364
pid                                                                 &lt;0.24.0>
 
365
name                                                         release_handler
 
366
start_function                               {release_handler,start_link,[]}
 
367
restart_type                                                       permanent
 
368
shutdown                                                                2000
 
369
child_type                                                            worker
 
370
\011
 
371
\011ok
 
372
      </pre>
 
373
 
 
374
      <section>
 
375
        <title>Stop the Server</title>
 
376
        <p>Stop the <c>rb_server</c>  with the function
 
377
          <c>rb:stop()</c>:</p>
 
378
        <pre>
 
379
 
 
380
13><input>rb:stop().</input>
 
381
ok
 
382
        </pre>
 
383
      </section>
 
384
    </section>
 
385
  </section>
 
386
</chapter>
 
387