commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10804] - Define and implement Logging policy
Date Sun, 28 Jul 2002 18:00:18 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10804>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10804

Define and implement Logging policy

jsdever@sympatico.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|commons-                    |jsdever@sympatico.ca
                   |dev@jakarta.apache.org      |



------- Additional Comments From jsdever@sympatico.ca  2002-07-28 18:00 -------
More refined:

1) Log the entry to every method at the trace level.  (exits not required
due to difficulty in determing exit points)
        log.trace("enter SomeClass.SomeMethod(Class, Class)");

2) Only/always log exception stack traces at the debug level
        } catch (Exception ex) {
            log.debug

3) Any swallowed exceptions should log the exception at the debug level
        try {
            thread.sleep();
        } catch (InterruptedException ie) {
            //expected
            log.debug("Caught interrupted exception");
        }

4) Error,Warn,Info messages should be suitable for users to view.  Code
specific details should be kept to Debug and Trace. 

5) instantiate one static logger per class like this:
        private static final Log log = LogFactory.getLog(CLASS.class);

6) Any messages that are passed over an open network connection should be
logged on the wirelog:
        private static final Log wireLog =
LogFactory.getLog("httpclient.wire");

7) Any logging statement that causes other method calls in the construction
of its arguments must be protected by a isXXXEnabled() conditional (except
when already protected by a try/catch block):
        if (log.isDebugEnabled() {
            log.debug("some text" + someVar + "some more text");
        }
        try {
            //some code
        } catch (Exception ex) {
            log.warn("Failed to execute some code: " + ex.getMessage());
            log.debug("Unexpected exception caught", ex);
        }

8) At this point there will be no internationalization of logging messages,
but it may be added in the future.

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message