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