On 5/31/11 1:32 PM, Steven Schveighoffer wrote:
On Tue, 31 May 2011 14:10:20 -0400, Jose Armando Garcia
<[email protected]> wrote:
On Tue, May 31, 2011 at 2:34 PM, Steven Schveighoffer
<[email protected]> wrote:
Again, this sounds way too complicated for what it's giving you
(avoiding
having to forcibly kill your application if that's what you desire).
If I
had to choose from your options, I'd use neither critical nor fatal. I'd
probably just stick with the higher levels, and start putting my own
levels
in as strings to avoid what I'd consider to be "buggy" behavior...
From my own experience, I almost never *never* use a forced kill. A
graceful shutdown works much better. Remember that a 'fatal' error is
not
so much a "this program can't continue because it's not sane," but a
"this
program cannot continue because something is misconfigured, etc."
This does
not warrant raw destruction.
That is probably because most programmers write web application in
which independent request/processing are all handle by the same
process. So by definition since requests are independent it is unfair
for one request to affect another request (by asserting) because they
share the same process. Not everyone writes application using that
model. If your programming model is such (or architecture if you
prefer that word ;), then yes using fatal("") is not wise but maybe
critical("") and error("") is.
If critical throws, then it is also of no use. I want to control when
exceptions are thrown, I don't want exceptions or program halting to be
the tax for using the logging facility.
I can see this pattern emerging:
try
{
logCritical("critical error encountered!");
}
catch(Exception e){} // stupid std.log...
I don't understand this. You are at the same time using logCritical,
which has as its MAIN distinction from logError the fact that it throws,
to then complain about that very distinction and manually arrange things
to be identical.
Why not use logError?
There are two logs that behave almost the same: logInfo and logError. I
think that should be enough choice. Then we have two logs that add
value: logCritical and logFatal. What is wrong about that?
Andrei