RE: Logging error page into log4j
Steve, I did'nt need to create a specific error page, but thanks for the ExceptionAnalyzer code snippet... that came pretty handy. Thanks, Amir --- Steve Shucker <[EMAIL PROTECTED]> wrote: > My team did something like this recently. We put a line in our > *.application file: > > > > Then we copied/modified the code from tapestry's error page so we could pipe > tapestry's stacktrace generation to log4j. The actual html/page file was > just our friendly message and layout with the original tapestry > implementation sitting in a hidden div to make life easy for developers. > Here's our code: > > public abstract class ErrorPage extends BasePage { > > @InjectObject("service:tapestry.globals.HttpServletResponse") > public abstract HttpServletResponse getResponse(); > > private static final Logger log = > Logger.getLogger("com.vms.adsite.pages.ErrorPage"); > > public abstract void setExceptions(ExceptionDescription[] exceptions); > > public void setException(Throwable value) { > ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); > ExceptionDescription[] exceptions = analyzer.analyze(value); > setExceptions(exceptions); > String text = ""; > for (ExceptionDescription exception : exceptions) { > text += "Class: " + exception.getExceptionClassName() + > "\n"; > text += "Message: " + exception.getMessage() + "\n"; > for (ExceptionProperty property : exception.getProperties()) > { > text += "Property: " + property.getName() + " = " + > property.getValue() + "\n"; > } > } > String[] stack = exceptions[exceptions.length-1].getStackTrace(); > for (String stackItem : stack) { > text += stackItem + "\n"; > } > log.error(text); > } > } > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 21, 2006 6:43 AM > To: tapestry-user@jakarta.apache.org > Subject: Logging error page into log4j > > Hi all, > > How do get the default error page to log into log4j? > > I really dont need to overide the default error page (this is an internal > application) but I do need the errors logged. Any help is appreciated! > > Thanks, > Amir > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging error page into log4j
That did the trick. Thanks! --- James Carman <[EMAIL PROTECTED]> wrote: > Copy the definition from the original hivemodule.xml: > > > > > value="infrastructure:exceptionPageName"/> > value="infrastructure:requestExceptionReporter"/> >value="infrastructure:responseRenderer"/> > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 21, 2006 10:46 AM > To: James Carman; 'Tapestry users' > Subject: RE: Logging error page into log4j > > I wish it was that simple, but it's not working! The problem is that the > _exceptionPageName field is not being set. When I removed the hivemodule.xml > entry, the field gets populated with "Exception". So I tried this just to > see > if it works: > >@Override > public void presentException(final IRequestCycle cycle, final > Throwable cause) > { >logger.error(cause); >setExceptionPageName("Exception"); >super.presentException(cycle, cause); >} > > I still get a blank page! > > --- James Carman <[EMAIL PROTECTED]> wrote: > > > Just extend ExceptionPresenterImpl and call your superclass' > implementation! > > :-) Ain't object-oriented programming great? > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, June 21, 2006 10:33 AM > > To: Tapestry users > > Subject: RE: Logging error page into log4j > > > > Hi James, > > > > I created my own ExceptionPresenter and added the entry to the > > hivemodule.xml > > file and it now logs, but the original error display page is not showing. > Is > > there any way to display the error (as it does by default) and log it? > > > > Thanks, > > Amir > > > > > > --- James Carman <[EMAIL PROTECTED]> wrote: > > > > > Override the implementation of the tapestry.error.ExceptionPresenter > > service > > > point (until I change the way it works). In your hivemodule.xml file: > > > > > > > > > > > > > > > > > > > > > > > > -Original Message- > > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > > > > > Sent: Wednesday, June 21, 2006 9:43 AM > > > To: tapestry-user@jakarta.apache.org > > > Subject: Logging error page into log4j > > > > > > Hi all, > > > > > > How do get the default error page to log into log4j? > > > > > > I really dont need to overide the default error page (this is an > internal > > > application) but I do need the errors logged. Any help is appreciated! > > > > > > Thanks, > > > Amir > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging error page into log4j
Copy the definition from the original hivemodule.xml: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 10:46 AM To: James Carman; 'Tapestry users' Subject: RE: Logging error page into log4j I wish it was that simple, but it's not working! The problem is that the _exceptionPageName field is not being set. When I removed the hivemodule.xml entry, the field gets populated with "Exception". So I tried this just to see if it works: @Override public void presentException(final IRequestCycle cycle, final Throwable cause) { logger.error(cause); setExceptionPageName("Exception"); super.presentException(cycle, cause); } I still get a blank page! --- James Carman <[EMAIL PROTECTED]> wrote: > Just extend ExceptionPresenterImpl and call your superclass' implementation! > :-) Ain't object-oriented programming great? > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 21, 2006 10:33 AM > To: Tapestry users > Subject: RE: Logging error page into log4j > > Hi James, > > I created my own ExceptionPresenter and added the entry to the > hivemodule.xml > file and it now logs, but the original error display page is not showing. Is > there any way to display the error (as it does by default) and log it? > > Thanks, > Amir > > > --- James Carman <[EMAIL PROTECTED]> wrote: > > > Override the implementation of the tapestry.error.ExceptionPresenter > service > > point (until I change the way it works). In your hivemodule.xml file: > > > > > > > > > > > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, June 21, 2006 9:43 AM > > To: tapestry-user@jakarta.apache.org > > Subject: Logging error page into log4j > > > > Hi all, > > > > How do get the default error page to log into log4j? > > > > I really dont need to overide the default error page (this is an internal > > application) but I do need the errors logged. Any help is appreciated! > > > > Thanks, > > Amir > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging error page into log4j
I wish it was that simple, but it's not working! The problem is that the _exceptionPageName field is not being set. When I removed the hivemodule.xml entry, the field gets populated with "Exception". So I tried this just to see if it works: @Override public void presentException(final IRequestCycle cycle, final Throwable cause) { logger.error(cause); setExceptionPageName("Exception"); super.presentException(cycle, cause); } I still get a blank page! --- James Carman <[EMAIL PROTECTED]> wrote: > Just extend ExceptionPresenterImpl and call your superclass' implementation! > :-) Ain't object-oriented programming great? > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 21, 2006 10:33 AM > To: Tapestry users > Subject: RE: Logging error page into log4j > > Hi James, > > I created my own ExceptionPresenter and added the entry to the > hivemodule.xml > file and it now logs, but the original error display page is not showing. Is > there any way to display the error (as it does by default) and log it? > > Thanks, > Amir > > > --- James Carman <[EMAIL PROTECTED]> wrote: > > > Override the implementation of the tapestry.error.ExceptionPresenter > service > > point (until I change the way it works). In your hivemodule.xml file: > > > > > > > > > > > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, June 21, 2006 9:43 AM > > To: tapestry-user@jakarta.apache.org > > Subject: Logging error page into log4j > > > > Hi all, > > > > How do get the default error page to log into log4j? > > > > I really dont need to overide the default error page (this is an internal > > application) but I do need the errors logged. Any help is appreciated! > > > > Thanks, > > Amir > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging error page into log4j
Just extend ExceptionPresenterImpl and call your superclass' implementation! :-) Ain't object-oriented programming great? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 10:33 AM To: Tapestry users Subject: RE: Logging error page into log4j Hi James, I created my own ExceptionPresenter and added the entry to the hivemodule.xml file and it now logs, but the original error display page is not showing. Is there any way to display the error (as it does by default) and log it? Thanks, Amir --- James Carman <[EMAIL PROTECTED]> wrote: > Override the implementation of the tapestry.error.ExceptionPresenter service > point (until I change the way it works). In your hivemodule.xml file: > > > > > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 21, 2006 9:43 AM > To: tapestry-user@jakarta.apache.org > Subject: Logging error page into log4j > > Hi all, > > How do get the default error page to log into log4j? > > I really dont need to overide the default error page (this is an internal > application) but I do need the errors logged. Any help is appreciated! > > Thanks, > Amir > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging error page into log4j
Hi James, I created my own ExceptionPresenter and added the entry to the hivemodule.xml file and it now logs, but the original error display page is not showing. Is there any way to display the error (as it does by default) and log it? Thanks, Amir --- James Carman <[EMAIL PROTECTED]> wrote: > Override the implementation of the tapestry.error.ExceptionPresenter service > point (until I change the way it works). In your hivemodule.xml file: > > > > > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 21, 2006 9:43 AM > To: tapestry-user@jakarta.apache.org > Subject: Logging error page into log4j > > Hi all, > > How do get the default error page to log into log4j? > > I really dont need to overide the default error page (this is an internal > application) but I do need the errors logged. Any help is appreciated! > > Thanks, > Amir > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging error page into log4j
My team did something like this recently. We put a line in our *.application file: Then we copied/modified the code from tapestry's error page so we could pipe tapestry's stacktrace generation to log4j. The actual html/page file was just our friendly message and layout with the original tapestry implementation sitting in a hidden div to make life easy for developers. Here's our code: public abstract class ErrorPage extends BasePage { @InjectObject("service:tapestry.globals.HttpServletResponse") public abstract HttpServletResponse getResponse(); private static final Logger log = Logger.getLogger("com.vms.adsite.pages.ErrorPage"); public abstract void setExceptions(ExceptionDescription[] exceptions); public void setException(Throwable value) { ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); String text = ""; for (ExceptionDescription exception : exceptions) { text += "Class: " + exception.getExceptionClassName() + "\n"; text += "Message: " + exception.getMessage() + "\n"; for (ExceptionProperty property : exception.getProperties()) { text += "Property: " + property.getName() + " = " + property.getValue() + "\n"; } } String[] stack = exceptions[exceptions.length-1].getStackTrace(); for (String stackItem : stack) { text += stackItem + "\n"; } log.error(text); } } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 6:43 AM To: tapestry-user@jakarta.apache.org Subject: Logging error page into log4j Hi all, How do get the default error page to log into log4j? I really dont need to overide the default error page (this is an internal application) but I do need the errors logged. Any help is appreciated! Thanks, Amir - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging error page into log4j
Override the implementation of the tapestry.error.ExceptionPresenter service point (until I change the way it works). In your hivemodule.xml file: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 9:43 AM To: tapestry-user@jakarta.apache.org Subject: Logging error page into log4j Hi all, How do get the default error page to log into log4j? I really dont need to overide the default error page (this is an internal application) but I do need the errors logged. Any help is appreciated! Thanks, Amir - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]