1<!--$Id: db_set_error_stream.so,v 10.2 2002/08/18 21:15:54 bostic Exp $-->
2<!--$Id: env_set_error_stream.so,v 10.30 2006/02/10 22:54:59 bostic Exp $-->
3<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
4<!--See the file LICENSE for redistribution information.-->
5<html>
6<head>
7<title>Berkeley DB: Db::set_error_stream</title>
8<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
10</head>
11<body bgcolor=white>
12<table width="100%"><tr valign=top>
13<td>
14<b>Db::set_error_stream</b>
15</td>
16<td align=right>
17<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
18<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
19</tr></table>
20<hr size=1 noshade>
21<tt>
22<b><pre>
23#include &lt;db_cxx.h&gt;
24<p>
25void Db::set_error_stream(class ostream*);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: Db::set_error_stream</b>
29<p>When an error occurs in the Berkeley DB library, an exception is thrown or an
30<b>errno</b> value is returned by the interface.  In some cases,
31however, the <b>errno</b> value may be insufficient to completely
32describe the cause of the error, especially during initial application
33debugging.</p>
34<p>The <a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> and Db::set_error_stream methods
35are used to enhance the mechanism for reporting error messages to the
36application by setting the C++ ostream used for displaying additional
37Berkeley DB error messages.  In some cases, when an error occurs, Berkeley DB will
38output an additional error message to the specified stream.</p>
39<p>The error message will consist of the prefix string and a colon
40("<b>:</b>") (if a prefix string was previously specified using
41<a href="../api_cxx/env_set_errpfx.html">DbEnv::set_errpfx</a>), an error string, and a trailing
42&lt;newline&gt; character.</p>
43<p>Setting <b>stream</b> to NULL unconfigures the interface.</p>
44<p>Alternatively, you can use the <a href="../api_cxx/env_set_errfile.html">DbEnv::set_errfile</a> and
45<a href="../api_cxx/db_set_errfile.html">Db::set_errfile</a> methods to display the additional information via a C
46library FILE *, or the <a href="../api_cxx/env_set_errcall.html">DbEnv::set_errcall</a> and
47<a href="../api_cxx/db_set_errcall.html">Db::set_errcall</a> methods to capture the additional error information
48in a way that does not use either output streams or C library FILE *'s.
49You should not mix these approaches.</p>
50<p>This error-logging enhancement does not slow performance or significantly
51increase application size, and may be run during normal operation as well
52as during application debugging.</p>
53<p>For <a href="../api_cxx/db_class.html">Db</a> handles opened inside of Berkeley DB environments, calling the
54Db::set_error_stream method affects the entire environment and is equivalent to calling
55the <a href="../api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> method.</p>
56<p>The Db::set_error_stream method configures operations performed using the specified
57<a href="../api_cxx/db_class.html">Db</a> handle, not all operations performed on the underlying
58database.</p>
59<p>The Db::set_error_stream method may be called at any time during the life of the
60application.</p>
61<b>Parameters</b> <br>
62 <b>stream</b><ul compact><li>The <b>stream</b> parameter is the application-specified output stream to
63be used for additional error information.</ul>
64<br>
65<hr size=1 noshade>
66<br><b>Class</b>
67<a href="../api_cxx/db_class.html">Db</a>
68<br><b>See Also</b>
69<a href="../api_cxx/db_list.html">Databases and Related Methods</a>
70</tt>
71<table width="100%"><tr><td><br></td><td align=right>
72<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
73</td></tr></table>
74<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
75</body>
76</html>
77