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