Fixed nits & rewording to help distinguish between util/tooling and framework/middleware.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -153,7 +153,7 @@ that logging should be performed, before incurring the overhead of the logging m
|
|||||||
Yes, the logging methods will perform the same check, but only after resolving parameters.
|
Yes, the logging methods will perform the same check, but only after resolving parameters.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h4>General - Message Priorities</h4>
|
<h4>General - Message Priorities/Levels</h4>
|
||||||
It is important to ensure that log message are
|
It is important to ensure that log message are
|
||||||
appropriate in content and severity.
|
appropriate in content and severity.
|
||||||
The following guidelines are strongly suggested:
|
The following guidelines are strongly suggested:
|
||||||
@@ -186,6 +186,12 @@ Expect these to be written to logs only.
|
|||||||
These NEED NOT be internationalized, but it never hurts...</li>
|
These NEED NOT be internationalized, but it never hurts...</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h4>General - Default Message Priority/Level</h4>
|
||||||
|
<p>
|
||||||
|
By default the message priority should be no lower than <b>info</b>.
|
||||||
|
That is, by default <b>debug</b> message should not be seen in the logs.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h4>Enterprise - Logging Exceptions</h4>
|
<h4>Enterprise - Logging Exceptions</h4>
|
||||||
The general rule in dealing with exceptions is to assume that
|
The general rule in dealing with exceptions is to assume that
|
||||||
the user (developer using a tooling/middleware API) isn't going
|
the user (developer using a tooling/middleware API) isn't going
|
||||||
@@ -195,14 +201,21 @@ it's in your best interest to be prepared with the proactive
|
|||||||
tools necessary to demonstrate that your component works correctly,
|
tools necessary to demonstrate that your component works correctly,
|
||||||
or at worst that the problem analyzed from your logs.
|
or at worst that the problem analyzed from your logs.
|
||||||
For this discussion, we must make a distinction between different types of exceptions
|
For this discussion, we must make a distinction between different types of exceptions
|
||||||
based on what kind of boundries they cross:
|
based on what kind of boundaries they cross:
|
||||||
<ul>
|
<ul>
|
||||||
<li><p><b>External Boundries - Expected Exceptions</b>.
|
<li><p><b>External Boundaries - Expected Exceptions</b>.
|
||||||
This classification includes exceptions such as <code>FileNotFoundException</code>
|
This classification includes exceptions such as <code>FileNotFoundException</code>
|
||||||
that cross API/SPI boundries, and are exposed to the user of a component/toolkit.
|
that cross API/SPI boundaries, and are exposed to the user of a component/toolkit.
|
||||||
These are listed in the 'throws' clause of a method signature.
|
These are listed in the 'throws' clause of a method signature.
|
||||||
</p>
|
</p>
|
||||||
<p>These exceptions should be caught immediatly prior to crossing
|
<p>
|
||||||
|
Appropriate handling of these exceptions depends upon the type
|
||||||
|
of code you are developing.
|
||||||
|
API's for utility functions and tools should log these at the <b>debug</b> level,
|
||||||
|
if they are caught at all by internal code.
|
||||||
|
</p>
|
||||||
|
<p>For higher level frameworks and middleware components,
|
||||||
|
these exceptions should be caught immediatly prior to crossing
|
||||||
the API/SPI interface back to user code-space,
|
the API/SPI interface back to user code-space,
|
||||||
logged with full stack trace at <b>info</b> level,
|
logged with full stack trace at <b>info</b> level,
|
||||||
and rethrown.
|
and rethrown.
|
||||||
@@ -211,13 +224,20 @@ future analysis <i>in the event that the exception is not caught and resolved
|
|||||||
as expected by the user's code</i>.
|
as expected by the user's code</i>.
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li><p><b>External Boundries - Unexpected Exceptions</b>.
|
<li><p><b>External Boundaries - Unexpected Exceptions</b>.
|
||||||
This classification includes exceptions such as <code>NullPointerException</code>
|
This classification includes exceptions such as <code>NullPointerException</code>
|
||||||
that cross API/SPI boundries, and are exposed to the user of a component/toolkit.
|
that cross API/SPI boundaries, and are exposed to the user of a component/toolkit.
|
||||||
These are runtime exceptions/error that are NOT
|
These are runtime exceptions/error that are NOT
|
||||||
listed in the 'throws' clause of a method signature.
|
listed in the 'throws' clause of a method signature.
|
||||||
</p>
|
</p>
|
||||||
<p>These exceptions should be caught immediatly prior to crossing
|
<p>
|
||||||
|
Appropriate handling of these exceptions depends upon the type
|
||||||
|
of code you are developing.
|
||||||
|
API's for utility functions and tools should log these at the <b>debug</b> level,
|
||||||
|
if they are caught at all.
|
||||||
|
</p>
|
||||||
|
<p>For higher level frameworks and middleware components,
|
||||||
|
these exceptions should be caught immediatly prior to crossing
|
||||||
the API/SPI interface back to user code-space,
|
the API/SPI interface back to user code-space,
|
||||||
logged with full stack trace at <b>info</b> level,
|
logged with full stack trace at <b>info</b> level,
|
||||||
and rethrown/wrapped as <code><i>Component</i>InternalError</code>.
|
and rethrown/wrapped as <code><i>Component</i>InternalError</code>.
|
||||||
@@ -225,15 +245,17 @@ The assures that the log contains a record of the root cause for
|
|||||||
future analysis <i>in the event that the exception is not caught and
|
future analysis <i>in the event that the exception is not caught and
|
||||||
logged/reported as expected by the user's code</i>.
|
logged/reported as expected by the user's code</i>.
|
||||||
</p></li>
|
</p></li>
|
||||||
<li><p><b>Internal Boundries</b>.
|
<li><p><b>Internal Boundaries</b>.
|
||||||
Exceptions that occur internally and are resolved internally.
|
Exceptions that occur internally and are resolved internally.
|
||||||
These should be logged when caught as <b>debug</b> or <b>info</b> messages,
|
These should be logged when caught as <b>debug</b> or <b>info</b> messages,
|
||||||
at your discretion.
|
at the programmer's discretion.
|
||||||
</p></li>
|
</p></li>
|
||||||
<li><p><b>Significant Internal Boundries</b>.
|
<li><p><b>Significant Internal Boundaries</b>.
|
||||||
Exceptions that cross over significant internal component boundries, such as networks.
|
This typically only applies to middleware components
|
||||||
|
that span networks or runtime processes.
|
||||||
|
Exceptions that cross over significant internal component boundaries, such as networks.
|
||||||
These should be logged when caught as <b>info</b> messages.
|
These should be logged when caught as <b>info</b> messages.
|
||||||
Do not assume that such a (network) boundry will deliver exceptions to the 'other side'.
|
Do not assume that such a (process/network) boundary will deliver exceptions to the 'other side'.
|
||||||
</p></li>
|
</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user