1<!--$Id: env_set_errfile.so,v 10.37 2006/10/26 15:33:59 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;set_errfile</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;set_errfile</b>
14</td>
15<td align=right>
16<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24void
25DB_ENV-&gt;set_errfile(DB_ENV *dbenv, FILE *errfile);
26<p>
27void
28DB_ENV-&gt;get_errfile(DB_ENV *dbenv, FILE **errfilep);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB_ENV-&gt;set_errfile</b>
32When an error occurs in the Berkeley DB library, a Berkeley DB error or an error
33return value is returned by the interface.  In some cases, however, the
34return value may be insufficient to completely describe the cause of the
35error especially during initial application debugging.
36<p>The DB_ENV-&gt;set_errfile and <a href="/api_c/db_set_errfile.html">DB-&gt;set_errfile</a> methods are used to
37enhance the mechanism for reporting error messages to the application
38by setting a C library FILE * to be used for displaying additional Berkeley DB
39error messages.  In some cases, when an error occurs, Berkeley DB will output
40an additional error message to the specified file reference.</p>
41<p>The error message will consist of the prefix string and a colon
42("<b>:</b>") (if a prefix string was previously specified using
43<a href="/api_c/db_set_errpfx.html">DB-&gt;set_errpfx</a> or <a href="/api_c/env_set_errpfx.html">DB_ENV-&gt;set_errpfx</a>), an error string, and
44a trailing &lt;newline&gt; character.</p>
45<p>The default configuration when applications first create <a href="/api_c/db_class.html">DB</a> or
46<a href="/api_c/env_class.html">DB_ENV</a> handles is as if the DB_ENV-&gt;set_errfile or
47<a href="/api_c/db_set_errfile.html">DB-&gt;set_errfile</a> methods were called with the standard error output
48(stderr) specified as the FILE * argument.  Applications wanting no
49output at all can turn off this default configuration by calling the
50DB_ENV-&gt;set_errfile or <a href="/api_c/db_set_errfile.html">DB-&gt;set_errfile</a> methods with NULL as the
51FILE * argument.  Additionally, explicitly configuring the error output
52channel using any of the DB_ENV-&gt;set_errfile,
53<a href="/api_c/db_set_errfile.html">DB-&gt;set_errfile</a>, <a href="/api_c/env_set_errcall.html">DB_ENV-&gt;set_errcall</a>,
54<a href="/api_c/db_set_errcall.html">DB-&gt;set_errcall</a>, <a href="/api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> or
55<a href="/api_cxx/db_set_error_stream.html">Db::set_error_stream</a> methods will also turn off this default output
56for the application.</p>
57<p>This error logging enhancement does not slow performance or significantly
58increase application size, and may be run during normal operation as well
59as during application debugging.</p>
60<p>The DB_ENV-&gt;set_errfile method configures operations performed using the specified
61<a href="/api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying
62database environment.</p>
63<p>The DB_ENV-&gt;set_errfile method may be called at any time during the life of the
64application.</p>
65<b>Parameters</b> <br>
66 <b>errfile</b><ul compact><li>The <b>errfile</b> parameter is a C library FILE * to be used for
67displaying additional Berkeley DB error information.</ul>
68<br>
69<hr size=1 noshade>
70<b>Description: DB_ENV-&gt;get_errfile</b>
71<p>The DB_ENV-&gt;get_errfile method returns the FILE *.</p>
72<p>The DB_ENV-&gt;get_errfile method may be called at any time during the life of the
73application.</p>
74<p>The DB_ENV-&gt;get_errfile method
75returns a non-zero error value on failure
76and 0 on success.
77</p>
78<b>Parameters</b> <br>
79 <b>errfilep</b><ul compact><li>The DB_ENV-&gt;get_errfile method returns  the
80FILE * in <b>errfilep</b>.</ul>
81<br>
82<hr size=1 noshade>
83<br><b>Class</b>
84<a href="/api_c/env_class.html">DB_ENV</a>
85<br><b>See Also</b>
86<a href="/api_c/env_list.html">Database Environments and Related Methods</a>
87</tt>
88<table width="100%"><tr><td><br></td><td align=right>
89<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
90</td></tr></table>
91<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
92</body>
93</html>
94