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