I was going to suggest something similar to what gman
said, but then I thought if you were having database issues, one of those issues might be that the DB is down, so recording errors in the DB might not work out so well.
I came up with two ideas: 1) Have all processes write their errors to log files named by process ID; then have a separate process create a report from those logs and email the admin. 2) Have a daemon listening on a socket (maybe a unix socket for simplicity) and have all processes write their errors to that socket. This process will make the decisions about which errors to report.
Both options have the advantage of the reporting logic being in one place, and there shouldn't be any race conditions.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.