Reputation: 1820
When developing in seaside the stack traces are printed into the browser. When deploying the application I don't want users to see this information but I would like a log of any stack traces on the server side for debugging. In my current app I have the following configuration:
ZnZincServerAdaptor startOn: 1701.
ZnZincServerAdaptor default server logLevel: 2; logToTranscript.
WAAdmin clearAll.
WAEnvironment configureApplicationDefaults.
WAEnvironment registerDefaultRequestHandlers.
WAAdmin applicationDefaults removeParent: WADevelopmentConfiguration instance.
WAAdmin applicationExceptionHandlingDefaults at: #exceptionHandler put: WAErrorHandler.
BabyTrackerApp initialize.
WAAdmin defaultDispatcher defaultName: 'babytracker'.
Transcript show: 'Baby Tracker started'; cr
Which I initially copied from svenvc/reddit on GitHub.
What I find with this setup is that there is logging on the server when requests come in, but not the stack traces of any errors only the one line summary showing the time of the request and the HTTP status code.
What additional configuration is needed to log the stack traces?
Upvotes: 3
Views: 82
Reputation: 1218
Every Seaside request is handled within a chain of request handlers, one of which is the "Error Handler" (usually the one at the top of the request processing), the default error handler during development will enable you to debug the app, and the one in your snippet is the WAErrorHandler
, which will print the exception in basic HTML and send it to the user.
You can define your own subclass of WAErrorHandler
, and use that newly defined class as your Error Handler class.
You define such handler class in the following statement:
WAAdmin applicationExceptionHandlingDefaults
at: #exceptionHandler put: WAErrorHandler.
Recently I started using Sentry to log all the exceptions, and for that I defined my own exception handler class that will report the exception to Sentry's server and enable me to analyze issues using a better platform.
You can find such integration in this repository: https://github.com/eMaringolo/seaside-sentry
Upvotes: 2