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