| 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_ENV->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 DB_ENV Handle" /> |
| 11 | <link rel="prev" href="envset_errcall.html" title="DB_ENV->set_errcall()" /> |
| 12 | <link rel="next" href="envset_errpfx.html" title="DB_ENV->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">DB_ENV->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 DB_ENV 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_errfile"></a>DB_ENV->set_errfile()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | void |
| 44 | DB_ENV->set_errfile(DB_ENV *dbenv, FILE *errfile); </pre> |
| 45 | <p> |
| 46 | When an error occurs in the Berkeley DB library, |
| 47 | <span> |
| 48 | a Berkeley DB error |
| 49 | </span> |
| 50 | |
| 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">DB_ENV->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 | |
| 67 | |
| 68 | <a class="xref" href="envset_errcall.html" title="DB_ENV->set_errcall()">DB_ENV->set_errcall()</a> or |
| 69 | <a class="xref" href="dbset_errcall.html" title="DB->set_errcall()">DB->set_errcall()</a> |
| 70 | methods to capture the additional error information in a way that does |
| 71 | not use C library FILE *'s. |
| 72 | |
| 73 | </p> |
| 74 | <p> |
| 75 | The error message will consist of the prefix string and a colon |
| 76 | ("<span class="bold"><strong>:</strong></span>") (if a prefix string was |
| 77 | previously specified using |
| 78 | <a class="xref" href="dbset_errpfx.html" title="DB->set_errpfx()">DB->set_errpfx()</a> or |
| 79 | <a class="xref" href="envset_errpfx.html" title="DB_ENV->set_errpfx()">DB_ENV->set_errpfx()</a> ), an |
| 80 | error string, and a trailing <newline> character. |
| 81 | </p> |
| 82 | <p> |
| 83 | The default configuration when applications first create |
| 84 | <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a> or |
| 85 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles is as if the |
| 86 | <a class="xref" href="dbset_errfile.html" title="DB->set_errfile()">DB->set_errfile()</a> or |
| 87 | <code class="methodname">DB_ENV->set_errfile()</code> methods were called with the standard error output |
| 88 | (stderr) specified as the FILE * argument. Applications wanting no |
| 89 | output at all can turn off this default configuration by calling the |
| 90 | <a class="xref" href="dbset_errfile.html" title="DB->set_errfile()">DB->set_errfile()</a> or |
| 91 | <code class="methodname">DB_ENV->set_errfile()</code> methods with NULL as the FILE * argument. |
| 92 | Additionally, explicitly configuring the error output channel using |
| 93 | any of the following methods will also turn off this default output for the application: |
| 94 | </p> |
| 95 | <div class="itemizedlist"> |
| 96 | <ul type="disc"> |
| 97 | <li> |
| 98 | <p> |
| 99 | <code class="methodname">DB_ENV->set_errfile()</code> |
| 100 | </p> |
| 101 | </li> |
| 102 | <li> |
| 103 | <p> |
| 104 | <a class="xref" href="dbset_errfile.html" title="DB->set_errfile()">DB->set_errfile()</a> |
| 105 | </p> |
| 106 | </li> |
| 107 | <li> |
| 108 | <p> |
| 109 | <a class="xref" href="envset_errcall.html" title="DB_ENV->set_errcall()">DB_ENV->set_errcall()</a> |
| 110 | </p> |
| 111 | </li> |
| 112 | <li> |
| 113 | <p> |
| 114 | <a class="xref" href="dbset_errcall.html" title="DB->set_errcall()">DB->set_errcall()</a> |
| 115 | </p> |
| 116 | </li> |
| 117 | </ul> |
| 118 | </div> |
| 119 | <p> |
| 120 | This error logging enhancement does not slow performance or |
| 121 | significantly increase application size, and may be run during normal |
| 122 | operation as well as during application debugging. |
| 123 | </p> |
| 124 | <p> |
| 125 | The <code class="methodname">DB_ENV->set_errfile()</code> method configures operations performed |
| 126 | using the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle, not all |
| 127 | operations performed on the underlying database environment. |
| 128 | </p> |
| 129 | <p> |
| 130 | The <code class="methodname">DB_ENV->set_errfile()</code> method may be called at any time during the |
| 131 | life of the application. |
| 132 | </p> |
| 133 | <div class="sect2" lang="en" xml:lang="en"> |
| 134 | <div class="titlepage"> |
| 135 | <div> |
| 136 | <div> |
| 137 | <h3 class="title"><a id="idp52004528"></a>Parameters</h3> |
| 138 | </div> |
| 139 | </div> |
| 140 | </div> |
| 141 | <div class="sect3" lang="en" xml:lang="en"> |
| 142 | <div class="titlepage"> |
| 143 | <div> |
| 144 | <div> |
| 145 | <h4 class="title"><a id="idp52002576"></a>errfile</h4> |
| 146 | </div> |
| 147 | </div> |
| 148 | </div> |
| 149 | <p> |
| 150 | The <span class="bold"><strong>errfile</strong></span> parameter is a C library |
| 151 | FILE * to be used for displaying additional Berkeley DB error |
| 152 | information. |
| 153 | </p> |
| 154 | </div> |
| 155 | </div> |
| 156 | <div class="sect2" lang="en" xml:lang="en"> |
| 157 | <div class="titlepage"> |
| 158 | <div> |
| 159 | <div> |
| 160 | <h3 class="title"><a id="idp52008840"></a>Class</h3> |
| 161 | </div> |
| 162 | </div> |
| 163 | </div> |
| 164 | <p> |
| 165 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 166 | </p> |
| 167 | </div> |
| 168 | <div class="sect2" lang="en" xml:lang="en"> |
| 169 | <div class="titlepage"> |
| 170 | <div> |
| 171 | <div> |
| 172 | <h3 class="title"><a id="idp52009920"></a>See Also</h3> |
| 173 | </div> |
| 174 | </div> |
| 175 | </div> |
| 176 | <p> |
| 177 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 178 | </p> |
| 179 | </div> |
| 180 | </div> |
| 181 | <div class="navfooter"> |
| 182 | <hr /> |
| 183 | <table width="100%" summary="Navigation footer"> |
| 184 | <tr> |
| 185 | <td width="40%" align="left"><a accesskey="p" href="envset_errcall.html">Prev</a> </td> |
| 186 | <td width="20%" align="center"> |
| 187 | <a accesskey="u" href="env.html">Up</a> |
| 188 | </td> |
| 189 | <td width="40%" align="right"> <a accesskey="n" href="envset_errpfx.html">Next</a></td> |
| 190 | </tr> |
| 191 | <tr> |
| 192 | <td width="40%" align="left" valign="top">DB_ENV->set_errcall() </td> |
| 193 | <td width="20%" align="center"> |
| 194 | <a accesskey="h" href="index.html">Home</a> |
| 195 | </td> |
| 196 | <td width="40%" align="right" valign="top"> DB_ENV->set_errpfx()</td> |
| 197 | </tr> |
| 198 | </table> |
| 199 | </div> |
| 200 | </body> |
| 201 | </html> |