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