Continuum

Creation of AbstractActionLogger that extends ActionSupport and implements LogEnabled

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.1-alpha-1
  • Component/s: None
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    2

Description

A class that will be use by all actions. This is to eliminate code repetition when actions implements the LogEnabled interface.

Activity

Hide
Teodoro Cue Jr. added a comment -

Added AbstractActionLogger that extends ActionSupport and implements LogEnabled. Edited 15 actions that has e.printStackTrace(). Added a logger that prints a more user friendly error message.

Show
Teodoro Cue Jr. added a comment - Added AbstractActionLogger that extends ActionSupport and implements LogEnabled. Edited 15 actions that has e.printStackTrace(). Added a logger that prints a more user friendly error message.
Hide
Trygve Laugstol added a comment -

1) Why can't the ActionSupport implement LogEnabled directly?
The logger field should not be protected, it should be private. The subclasses will access the logger through getLogger()

2) getLogger().logX() should always include the exception so it will be printed out on the console.

Show
Trygve Laugstol added a comment - 1) Why can't the ActionSupport implement LogEnabled directly? The logger field should not be protected, it should be private. The subclasses will access the logger through getLogger() 2) getLogger().logX() should always include the exception so it will be printed out on the console.
Hide
Carlos Sanchez added a comment -

Updated patch against trunk.

Comments:

remove the e.printStackTrace commands, that will print them on stdout

when exceptions are not rethrown again, use log.x(String , Exception ) instead of log.x(String), that way the exception stacktrace will be printed in the logger. If they are rethrown again you don't want to log them, they must be logged in another layer that catches them

addActionError must be used with a meaningful error for the user, eg. "your user id already exists, please choose another", never something like "jdbc error xx", so never append the exception message there.

Related to previous is CONTINUUM-778, where we try to avoid dealing with internal errors outside of actions, so most of the exception handling code in actions probably will be removed.

Show
Carlos Sanchez added a comment - Updated patch against trunk. Comments: remove the e.printStackTrace commands, that will print them on stdout when exceptions are not rethrown again, use log.x(String , Exception ) instead of log.x(String), that way the exception stacktrace will be printed in the logger. If they are rethrown again you don't want to log them, they must be logged in another layer that catches them addActionError must be used with a meaningful error for the user, eg. "your user id already exists, please choose another", never something like "jdbc error xx", so never append the exception message there. Related to previous is CONTINUUM-778, where we try to avoid dealing with internal errors outside of actions, so most of the exception handling code in actions probably will be removed.
Hide
Teodoro Cue Jr. added a comment -

-Replaced printStackTrace() methods with getLogger().error("", e)
-Deleted stack traces on addActionMessage() methods

Show
Teodoro Cue Jr. added a comment - -Replaced printStackTrace() methods with getLogger().error("", e) -Deleted stack traces on addActionMessage() methods
Hide
Carlos Sanchez added a comment -

Made actions throw exceptions not handled to be intercepted later by webwork interceptors

Show
Carlos Sanchez added a comment - Made actions throw exceptions not handled to be intercepted later by webwork interceptors

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: