| 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_errfile()</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_errcall.html" title="DbEnv::set_errcall()" /> |
| 12 | <link rel="next" href="envset_error_stream.html" title="DbEnv::set_error_stream()" /> |
| 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_errfile()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_errcall.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_error_stream.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_errfile"></a>DbEnv::set_errfile()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | void |
| 44 | DbEnv::set_errfile(FILE *errfile); </pre> |
| 45 | <p> |
| 46 | When an error occurs in the Berkeley DB library, |
| 47 | |
| 48 | <span> |
| 49 | an exception is thrown |
| 50 | </span> |
| 51 | or an error return value is returned by the interface. In some cases, |
| 52 | however, the return value may be insufficient to completely describe |
| 53 | the cause of the error especially during initial application |
| 54 | debugging. |
| 55 | </p> |
| 56 | <p> |
| 57 | The <code class="methodname">DbEnv::set_errfile()</code> and <a class="xref" href="dbset_errfile.html" title="Db::set_errfile()">Db::set_errfile()</a> |
| 58 | methods are used to enhance the mechanism for reporting error messages to the |
| 59 | application by setting a C library FILE * to be used for displaying |
| 60 | additional Berkeley DB error messages. In some cases, when an error |
| 61 | occurs, Berkeley DB will output an additional error message to the |
| 62 | specified file reference. |
| 63 | </p> |
| 64 | <p> |
| 65 | Alternatively, you can use the |
| 66 | <span> |
| 67 | <a class="xref" href="envset_error_stream.html" title="DbEnv::set_error_stream()">DbEnv::set_error_stream()</a> |
| 68 | and |
| 69 | <a class="xref" href="dbset_error_stream.html" title="Db::set_error_stream()">Db::set_error_stream()</a> |
| 70 | methods to display the additional messages via an output stream, or the |
| 71 | </span> |
| 72 | |
| 73 | <a class="xref" href="envset_errcall.html" title="DbEnv::set_errcall()">DbEnv::set_errcall()</a> or |
| 74 | <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 |
| 76 | not use C library FILE *'s. |
| 77 | <span>You should not mix these approaches.</span> |
| 78 | </p> |
| 79 | <p> |
| 80 | The error message will consist of the prefix string and a colon |
| 81 | ("<span class="bold"><strong>:</strong></span>") (if a prefix string was |
| 82 | previously specified using |
| 83 | <a class="xref" href="dbset_errpfx.html" title="Db::set_errpfx()">Db::set_errpfx()</a> or |
| 84 | <a class="xref" href="envset_errpfx.html" title="DbEnv::set_errpfx()">DbEnv::set_errpfx()</a> ), an |
| 85 | error string, and a trailing <newline> character. |
| 86 | </p> |
| 87 | <p> |
| 88 | The default configuration when applications first create |
| 89 | <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> or |
| 90 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handles is as if the |
| 91 | <a class="xref" href="dbset_errfile.html" title="Db::set_errfile()">Db::set_errfile()</a> or |
| 92 | <code class="methodname">DbEnv::set_errfile()</code> methods were called with the standard error output |
| 93 | (stderr) specified as the FILE * argument. Applications wanting no |
| 94 | output at all can turn off this default configuration by calling the |
| 95 | <a class="xref" href="dbset_errfile.html" title="Db::set_errfile()">Db::set_errfile()</a> or |
| 96 | <code class="methodname">DbEnv::set_errfile()</code> methods with NULL as the FILE * argument. |
| 97 | Additionally, explicitly configuring the error output channel using |
| 98 | any of the following methods will also turn off this default output for the application: |
| 99 | </p> |
| 100 | <div class="itemizedlist"> |
| 101 | <ul type="disc"> |
| 102 | <li> |
| 103 | <p> |
| 104 | <code class="methodname">DbEnv::set_errfile()</code> |
| 105 | </p> |
| 106 | </li> |
| 107 | <li> |
| 108 | <p> |
| 109 | <a class="xref" href="dbset_errfile.html" title="Db::set_errfile()">Db::set_errfile()</a> |
| 110 | </p> |
| 111 | </li> |
| 112 | <li> |
| 113 | <p> |
| 114 | <a class="xref" href="envset_errcall.html" title="DbEnv::set_errcall()">DbEnv::set_errcall()</a> |
| 115 | </p> |
| 116 | </li> |
| 117 | <li> |
| 118 | <p> |
| 119 | <a class="xref" href="dbset_errcall.html" title="Db::set_errcall()">Db::set_errcall()</a> |
| 120 | </p> |
| 121 | </li> |
| 122 | <li> |
| 123 | <p> |
| 124 | <a class="xref" href="envset_error_stream.html" title="DbEnv::set_error_stream()">DbEnv::set_error_stream()</a> |
| 125 | </p> |
| 126 | </li> |
| 127 | <li> |
| 128 | <p> |
| 129 | <a class="xref" href="dbset_error_stream.html" title="Db::set_error_stream()">Db::set_error_stream()</a> |
| 130 | </p> |
| 131 | </li> |
| 132 | </ul> |
| 133 | </div> |
| 134 | <p> |
| 135 | This error logging enhancement does not slow performance or |
| 136 | significantly increase application size, and may be run during normal |
| 137 | operation as well as during application debugging. |
| 138 | </p> |
| 139 | <p> |
| 140 | The <code class="methodname">DbEnv::set_errfile()</code> method configures operations performed |
| 141 | using the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle, not all |
| 142 | operations performed on the underlying database environment. |
| 143 | </p> |
| 144 | <p> |
| 145 | The <code class="methodname">DbEnv::set_errfile()</code> method may be called at any time during the |
| 146 | life of the application. |
| 147 | </p> |
| 148 | <div class="sect2" lang="en" xml:lang="en"> |
| 149 | <div class="titlepage"> |
| 150 | <div> |
| 151 | <div> |
| 152 | <h3 class="title"><a id="idp7267456"></a>Parameters</h3> |
| 153 | </div> |
| 154 | </div> |
| 155 | </div> |
| 156 | <div class="sect3" lang="en" xml:lang="en"> |
| 157 | <div class="titlepage"> |
| 158 | <div> |
| 159 | <div> |
| 160 | <h4 class="title"><a id="idp7338280"></a>errfile</h4> |
| 161 | </div> |
| 162 | </div> |
| 163 | </div> |
| 164 | <p> |
| 165 | The <span class="bold"><strong>errfile</strong></span> parameter is a C library |
| 166 | FILE * to be used for displaying additional Berkeley DB error |
| 167 | information. |
| 168 | </p> |
| 169 | </div> |
| 170 | </div> |
| 171 | <div class="sect2" lang="en" xml:lang="en"> |
| 172 | <div class="titlepage"> |
| 173 | <div> |
| 174 | <div> |
| 175 | <h3 class="title"><a id="idp7263408"></a>Class</h3> |
| 176 | </div> |
| 177 | </div> |
| 178 | </div> |
| 179 | <p> |
| 180 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 181 | </p> |
| 182 | </div> |
| 183 | <div class="sect2" lang="en" xml:lang="en"> |
| 184 | <div class="titlepage"> |
| 185 | <div> |
| 186 | <div> |
| 187 | <h3 class="title"><a id="idp7226976"></a>See Also</h3> |
| 188 | </div> |
| 189 | </div> |
| 190 | </div> |
| 191 | <p> |
| 192 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 193 | </p> |
| 194 | </div> |
| 195 | </div> |
| 196 | <div class="navfooter"> |
| 197 | <hr /> |
| 198 | <table width="100%" summary="Navigation footer"> |
| 199 | <tr> |
| 200 | <td width="40%" align="left"><a accesskey="p" href="envset_errcall.html">Prev</a> </td> |
| 201 | <td width="20%" align="center"> |
| 202 | <a accesskey="u" href="env.html">Up</a> |
| 203 | </td> |
| 204 | <td width="40%" align="right"> <a accesskey="n" href="envset_error_stream.html">Next</a></td> |
| 205 | </tr> |
| 206 | <tr> |
| 207 | <td width="40%" align="left" valign="top">DbEnv::set_errcall() </td> |
| 208 | <td width="20%" align="center"> |
| 209 | <a accesskey="h" href="index.html">Home</a> |
| 210 | </td> |
| 211 | <td width="40%" align="right" valign="top"> DbEnv::set_error_stream()</td> |
| 212 | </tr> |
| 213 | </table> |
| 214 | </div> |
| 215 | </body> |
| 216 | </html> |