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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.2 -->
<HTML>
<HEAD>
<TITLE>SASL Error Logging</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<CENTER>
<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif"></A>
</CENTER>
<A NAME="2"><!-- Empty --></A>
<H2>2 SASL Error Logging</H2>
<P>The SASL application introduces three types of reports:
<P>
<UL>
<LI>
supervisor report
</LI>
<LI>
progress report
</LI>
<LI>
crash report.
</LI>
</UL>
<P>When the SASL application is started, it adds a handler that
formats and writes these reports, as specified in the
configuration parameters for sasl, i.e the environment variables
in the SASL application specification, which is found in the
<CODE>.app</CODE> file of SASL. See
<A HREF="sasl_app.html">sasl(Application)</A>, and app(File)
in the Kernel Reference Manual
for the details.<A NAME="2.1"><!-- Empty --></A>
<H3>2.1 Supervisor Report</H3>
<P>A supervisor report is issued when a supervised child terminates in
an unexpected way. A supervisor report contains the following
items:
<P>
<DL>
<DT>
Supervisor.
</DT>
<DD>
The name of the reporting supervisor.
</DD>
<DT>
Context.
</DT>
<DD>
Indicates in which phase the child terminated
from the supervisor's point of view. This can be
<CODE>start_error</CODE>, <CODE>child_terminated</CODE>, or
<CODE>shutdown_error</CODE>.
</DD>
<DT>
Reason.
</DT>
<DD>
The termination reason.
</DD>
<DT>
Offender.
</DT>
<DD>
The start specification for the child.
</DD>
</DL>
<A NAME="2.2"><!-- Empty --></A>
<H3>2.2 Progress Report</H3>
<P>A progress report is issued whenever a supervisor starts or
restarts. A progress report contains the following items:
<P>
<DL>
<DT>
Supervisor.
</DT>
<DD>
The name of the reporting supervisor.
</DD>
<DT>
Started.
</DT>
<DD>
The start specification for the successfully
started child.
</DD>
</DL>
<A NAME="CRASH"><!-- Empty --></A><A NAME="2.3"><!-- Empty --></A>
<H3>2.3 Crash Report</H3>
<P>Processes started with the <CODE>proc_lib:spawn</CODE> or
<CODE>proc_lib:spawn_link</CODE> functions are wrapped within a
<CODE>catch</CODE>. A crash report is issued whenever such a process
terminates with an unexpected reason, which is any reason other
than <CODE>normal</CODE> or <CODE>shutdown</CODE>. Processes using the
<CODE>gen_server</CODE> and <CODE>gen_fsm</CODE> behaviours are examples of
such processes. A crash report contains the following items:
<P>
<DL>
<DT>
Crasher.
</DT>
<DD>
Information about the crashing process is reported, such
as initial function call, exit reason, and message queue.
</DD>
<DT>
Neighbours.
</DT>
<DD>
Information about processes which are linked to the crashing
process and do not trap exits. These processes are the
neighbours which will terminate because of this process
crash. The information gathered is the same as the information
for Crasher, shown in the previous item.
</DD>
</DL>
<A NAME="2.3.1"><!-- Empty --></A>
<H4>2.3.1 An Example</H4>
<P>The following example shows the reports which are generated
when a process crashes. The example process is an
<CODE>permanent</CODE> process supervised by the <CODE>test_sup</CODE>
supervisor. A division by zero is executed and the error is
first reported by the faulty process. A crash report is
generated as the process was started using the
<CODE>proc_lib:spawn/3</CODE> function. The supervisor generates a
supervisor report showing the process that has crashed, and then a
progress report is generated when the process is finally
re-started.
<PRE>
=ERROR REPORT==== 27-May-1996::13:38:56 ===
<0.63.0>: Divide by zero !
=CRASH REPORT==== 27-May-1996::13:38:56 ===
crasher:
pid: <0.63.0>
registered_name: []
error_info: {badarith,{test,s,[]}}
initial_call: {test,s,[]}
ancestors: [test_sup,<0.46.0>]
messages: []
links: [<0.47.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 128
stack_size: 128
reductions: 348
neighbours:
=SUPERVISOR REPORT==== 27-May-1996::13:38:56 ===
Supervisor: {local,test_sup}
Context: child_terminated
Reason: {badarith,{test,s,[]}}
Offender: [{pid,<0.63.0>},
{name,test},
{mfa,{test,t,[]}},
{restart_type,permanent},
{shutdown,200},
{child_type,worker}]
=PROGRESS REPORT==== 27-May-1996::13:38:56 ===
Supervisor: {local,test_sup}
Started: [{pid,<0.64.0>},
{name,test},
{mfa,{test,t,[]}},
{restart_type,permanent},
{shutdown,200},
{child_type,worker}]
</PRE>
<A NAME="2.4"><!-- Empty --></A>
<H3>2.4 Multi-File Error Report Logging</H3>
<P>Multi-file error report logging is used to store error messages,
which are received by the <CODE>error_logger</CODE>. The error messages
are stored in several files and each file is smaller than a
specified amount of kilobytes, and no more than a specified number
of files exist at the same time. The logging is very fast because
each error message is written as a binary term.
<P>Refer to
<CODE>sasl</CODE> application in the Reference Manual for more details.<A NAME="2.5"><!-- Empty --></A>
<H3>2.5 Report Browser</H3>
<P>The report browser is used to browse and format error reports
written by the error logger handler <CODE>error_logger_mf_h</CODE>.
<P>The <CODE>error_logger_mf_h</CODE> handler writes all reports to a
report logging directory. This directory is specified when
configuring the SASL application.
<P>If the report browser is
used off-line, the reports can be copied to another directory
which is specified when starting the browser. If no such directory
is specified, the browser reads reports from the SASL
<CODE>error_logger_mf_dir</CODE>.<A NAME="2.5.1"><!-- Empty --></A>
<H4>2.5.1 Starting the Report Browser</H4>
<P>Start the <CODE>rb_server</CODE> with the function
<CODE>rb:start([Options])</CODE> as shown in the following
example:
<PRE>
5><STRONG> rb:start([{max, 20}]).</STRONG>
rb: reading report...done.
rb: reading report...done.
rb: reading report...done.
rb: reading report...done.
</PRE>
<A NAME="2.5.2"><!-- Empty --></A>
<H4>2.5.2 On-line Help</H4>
<P>Enter the command <STRONG>rb:help().</STRONG> to access the report
browser on-line help system.<A NAME="2.5.3"><!-- Empty --></A>
<H4>2.5.3 List Reports in the Server</H4>
<P>The function <CODE>rb:list()</CODE> lists all loaded reports:
<PRE>
4><STRONG> rb:list().</STRONG>
No Type Process Date Time
== ==== ======= ==== ====
20 progress <0.17.0> 1996-10-16 16:14:54
19 progress <0.14.0> 1996-10-16 16:14:55
18 error <0.15.0> 1996-10-16 16:15:02
17 progress <0.14.0> 1996-10-16 16:15:06
16 progress <0.38.0> 1996-10-16 16:15:12
15 progress <0.17.0> 1996-10-16 16:16:14
14 progress <0.17.0> 1996-10-16 16:16:14
13 progress <0.17.0> 1996-10-16 16:16:14
12 progress <0.14.0> 1996-10-16 16:16:14
11 error <0.17.0> 1996-10-16 16:16:21
10 error <0.17.0> 1996-10-16 16:16:21
9 crash_report release_handler 1996-10-16 16:16:21
8 supervisor_report <0.17.0> 1996-10-16 16:16:21
7 progress <0.17.0> 1996-10-16 16:16:21
6 progress <0.17.0> 1996-10-16 16:16:36
5 progress <0.17.0> 1996-10-16 16:16:36
4 progress <0.17.0> 1996-10-16 16:16:36
3 progress <0.14.0> 1996-10-16 16:16:36
2 error <0.15.0> 1996-10-16 16:17:04
1 progress <0.14.0> 1996-10-16 16:17:09
ok
</PRE>
<A NAME="2.5.4"><!-- Empty --></A>
<H4>2.5.4 Show Reports</H4>
<P>To show details of a specific report, use the function
<CODE>rb:show(Number)</CODE>:
<PRE>
10> <STRONG>rb:show(1).</STRONG>
7> <STRONG>rb:show(4).</STRONG>
PROGRESS REPORT <0.20.0> 1996-10-16 16:16:36
===============================================================================
supervisor {local,sasl_sup}
started
[{pid,<0.24.0>},
{name,release_handler},
{mfa,{release_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
ok
8> rb:show(9).
CRASH REPORT <0.24.0> 1996-10-16 16:16:21
===============================================================================
Crashing process
pid <0.24.0>
registered_name release_handler
error_info {undef,{release_handler,mbj_func,[]}}
initial_call
{gen,init_it,
[gen_server,
<0.20.0>,
<0.20.0>,
{erlang,register},
release_handler,
release_handler,
[],
[]]}
ancestors [sasl_sup,<0.18.0>]
messages []
links [<0.23.0>,<0.20.0>]
dictionary []
trap_exit false
status running
heap_size 610
stack_size 142
reductions 54
ok
</PRE>
<A NAME="2.5.5"><!-- Empty --></A>
<H4>2.5.5 Search the Reports</H4>
<P>It is possible to show all reports which contain a common
pattern. Suppose a process crashes because it tries to call a
non-existing function <CODE>release_handler:mbj_func.</CODE> We could
then show reports as follows:
<PRE>
12><STRONG> rb:grep("mbj_func").</STRONG>
Found match in report number 11
ERROR REPORT <0.24.0> 1996-10-16 16:16:21
===============================================================================
** undefined function: release_handler:mbj_func[] **
Found match in report number 10
ERROR REPORT <0.24.0> 1996-10-16 16:16:21
===============================================================================
** Generic server release_handler terminating
** Last message in was {unpack_release,hej}
** When Server state == {state,[],
"/home/dup/otp2/otp_beam_sunos5_p1g_7",
[{release,
"OTP APN 181 01",
"P1G",
undefined,
[],
permanent}],
undefined}
** Reason for termination ==
** {undef,{release_handler,mbj_func,[]}}
Found match in report number 9
CRASH REPORT <0.24.0> 1996-10-16 16:16:21
===============================================================================
Crashing process
pid <0.24.0>
registered_name release_handler
error_info {undef,{release_handler,mbj_func,[]}}
initial_call
{gen,init_it,
[gen_server,
<0.20.0>,
<0.20.0>,
{erlang,register},
release_handler,
release_handler,
[],
[]]}
ancestors [sasl_sup,<0.18.0>]
messages []
links [<0.23.0>,<0.20.0>]
dictionary []
trap_exit false
status running
heap_size 610
stack_size 142
reductions 54
Found match in report number 8
SUPERVISOR REPORT <0.20.0> 1996-10-16 16:16:21
===============================================================================
Reporting supervisor {local,sasl_sup}
Child process
errorContext child_terminated
reason {undef,{release_handler,mbj_func,[]}}
pid <0.24.0>
name release_handler
start_function {release_handler,start_link,[]}
restart_type permanent
shutdown 2000
child_type worker
ok
</PRE>
<A NAME="2.5.5.1"><!-- Empty --></A>
<H5>2.5.5.1 Stop the Server</H5>
<P>Stop the <CODE>rb_server</CODE> with the function
<CODE>rb:stop()</CODE>:
<PRE>
13><STRONG> rb:stop().</STRONG>
ok
</PRE>
<CENTER>
<HR>
<SMALL>
Copyright © 1991-2004
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|