| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>DbEnv::set_error_stream()</title> |
| 7 | <link rel="stylesheet" href="apiReference.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> |
| 10 | <link rel="up" href="env.html" title="Chapter 5. The DbEnv Handle" /> |
| 11 | <link rel="prev" href="envset_errfile.html" title="DbEnv::set_errfile()" /> |
| 12 | <link rel="next" href="envset_errpfx.html" title="DbEnv::set_errpfx()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">DbEnv::set_error_stream()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_errfile.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 5. |
| 26 | The DbEnv Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envset_errpfx.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="envset_error_stream"></a>DbEnv::set_error_stream()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | void DbEnv::set_error_stream(class ostream*); </pre> |
| 44 | <p> |
| 45 | When an error occurs in the Berkeley DB library, an exception |
| 46 | is thrown or an <span class="bold"><strong>errno</strong></span> value |
| 47 | is returned by the interface. In some cases, however, the |
| 48 | <span class="bold"><strong>errno</strong></span> value may be |
| 49 | insufficient to completely describe the cause of the error, |
| 50 | especially during initial application debugging. |
| 51 | </p> |
| 52 | <p> |
| 53 | The <code class="methodname">DbEnv::set_error_stream()</code> and |
| 54 | <a class="xref" href="dbset_error_stream.html" title="Db::set_error_stream()">Db::set_error_stream()</a> |
| 55 | methods are used to enhance the mechanism for reporting error messages to the |
| 56 | application by setting the C++ ostream used for displaying |
| 57 | additional Berkeley DB error messages. In some cases, when an |
| 58 | error occurs, Berkeley DB will output an additional error message |
| 59 | to the specified stream. |
| 60 | </p> |
| 61 | <p> |
| 62 | The error message will consist of the prefix string and a colon |
| 63 | ("<span class="bold"><strong>:</strong></span>") (if a prefix string was |
| 64 | previously specified using |
| 65 | <a class="xref" href="dbset_errpfx.html" title="Db::set_errpfx()">Db::set_errpfx()</a>, |
| 66 | an error string, and a trailing <newline> character. |
| 67 | </p> |
| 68 | <p> |
| 69 | Setting <span class="bold"><strong>stream</strong></span> to NULL unconfigures the interface. |
| 70 | </p> |
| 71 | <p> |
| 72 | Alternatively, you can use the |
| 73 | <a class="xref" href="envset_errfile.html" title="DbEnv::set_errfile()">DbEnv::set_errfile()</a> or |
| 74 | <a class="xref" href="dbset_errfile.html" title="Db::set_errfile()">Db::set_errfile()</a> methods |
| 75 | to display the additional information via a C Library <code class="literal">FILE *</code>, |
| 76 | or the <a class="xref" href="envset_errcall.html" title="DbEnv::set_errcall()">DbEnv::set_errcall()</a> |
| 77 | and <a class="xref" href="dbset_errcall.html" title="Db::set_errcall()">Db::set_errcall()</a> |
| 78 | methods to capture the additional error information in a way that does not use either |
| 79 | output streams or C Library <code class="literal">FILE *</code>'s. |
| 80 | You should not mix these approaches. |
| 81 | </p> |
| 82 | <p> |
| 83 | This error-logging enhancement does not slow performance or significantly increase |
| 84 | application size, and may be run during normal operation as well as during application |
| 85 | debugging. |
| 86 | </p> |
| 87 | <p> |
| 88 | The <code class="methodname">DbEnv::set_error_stream()</code> method configures operations |
| 89 | performed using the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle, |
| 90 | not all operations performed on the underlying database environment. |
| 91 | </p> |
| 92 | <p> |
| 93 | The <code class="methodname">DbEnv::set_error_stream()</code> method may be called at any time during the |
| 94 | life of the application. |
| 95 | </p> |
| 96 | <div class="sect2" lang="en" xml:lang="en"> |
| 97 | <div class="titlepage"> |
| 98 | <div> |
| 99 | <div> |
| 100 | <h3 class="title"><a id="idp7358240"></a>Parameters</h3> |
| 101 | </div> |
| 102 | </div> |
| 103 | </div> |
| 104 | <div class="sect3" lang="en" xml:lang="en"> |
| 105 | <div class="titlepage"> |
| 106 | <div> |
| 107 | <div> |
| 108 | <h4 class="title"><a id="idp7358432"></a>stream</h4> |
| 109 | </div> |
| 110 | </div> |
| 111 | </div> |
| 112 | <p> |
| 113 | The <span class="bold"><strong>stream</strong></span> parameter is the |
| 114 | application-specified output stream to be used for additional error |
| 115 | information. |
| 116 | </p> |
| 117 | </div> |
| 118 | </div> |
| 119 | <div class="sect2" lang="en" xml:lang="en"> |
| 120 | <div class="titlepage"> |
| 121 | <div> |
| 122 | <div> |
| 123 | <h3 class="title"><a id="idp7344920"></a>Class</h3> |
| 124 | </div> |
| 125 | </div> |
| 126 | </div> |
| 127 | <p> |
| 128 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 129 | </p> |
| 130 | </div> |
| 131 | <div class="sect2" lang="en" xml:lang="en"> |
| 132 | <div class="titlepage"> |
| 133 | <div> |
| 134 | <div> |
| 135 | <h3 class="title"><a id="idp7345088"></a>See Also</h3> |
| 136 | </div> |
| 137 | </div> |
| 138 | </div> |
| 139 | <p> |
| 140 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 141 | </p> |
| 142 | </div> |
| 143 | </div> |
| 144 | <div class="navfooter"> |
| 145 | <hr /> |
| 146 | <table width="100%" summary="Navigation footer"> |
| 147 | <tr> |
| 148 | <td width="40%" align="left"><a accesskey="p" href="envset_errfile.html">Prev</a> </td> |
| 149 | <td width="20%" align="center"> |
| 150 | <a accesskey="u" href="env.html">Up</a> |
| 151 | </td> |
| 152 | <td width="40%" align="right"> <a accesskey="n" href="envset_errpfx.html">Next</a></td> |
| 153 | </tr> |
| 154 | <tr> |
| 155 | <td width="40%" align="left" valign="top">DbEnv::set_errfile() </td> |
| 156 | <td width="20%" align="center"> |
| 157 | <a accesskey="h" href="index.html">Home</a> |
| 158 | </td> |
| 159 | <td width="40%" align="right" valign="top"> DbEnv::set_errpfx()</td> |
| 160 | </tr> |
| 161 | </table> |
| 162 | </div> |
| 163 | </body> |
| 164 | </html> |