On 12/9/05, Don Brown <[EMAIL PROTECTED]> wrote:
> I'd like to see the logging taken down a notch, but perhaps not completely 
> out.
>   IMO, Mailreader is there to demonstrate Struts best practices and the 
> logging
> statements everywhere make one wonder :)  Besides, it gives a false impression
> Actions need to be long and detailed.  I'd rather see if we can get those
> Actions down under 10 lines each.  Leave "*Action was called"-type statements 
> to
> the framework.

As of this week, most of them are, and we're using real Dispatch
actions. Here's the Edit method from RegistrationAction, for example.

    public ActionForward Edit(
        ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response)
        throws Exception {

            final String method = Constants.EDIT;
            doLogProcess(mapping,method);

            HttpSession session = request.getSession();
            User user = doGetUser(session);
            boolean updating = (user!=null);
            if (updating) {
                doPopulate(form,user);
            }

           doSaveToken(request);
           return doFindSuccess(mapping);
    }

The logging is pushed back into helper methods, but some of the
helpers are more logging than logic:

    protected void doSaveToken(HttpServletRequest request) {
        if (log.isTraceEnabled()) {
            log.trace(Constants.LOG_TOKEN);
        }
        saveToken(request);
    }


I'm thinking we should do things like log the complete stack trace for
exceptions we catch, and such, but retaining  all the tracing
statements we now have, just makes it harder to see the trees. I don't
know if I would leave a trace statement for creating a transactional
token in a production application.

-Ted.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to