Re: error reporting in tomcat 8

Alan Kennedy <[email protected]>
Newsgroups gmane.comp.lang.jython.user
Message-ID <CAMte6h=kDOQfTNb1D3pYgAvE2Oeik5og4WCm5SU4cfZedKqq2A@mail.gmail.com>
I recommend that you deal with exceptions yourself, rather than relying on
Tomcat, and how the various different versions of it deal with exceptions.
That way your code and development environment will be portable between
versions of Tomcat, and to other servlet containers.

You could modify your code to catch any jython exception, generate a
printable version of the exception, and send it back as the response body.

You could do this in the PyServlet code, i.e. introduce java code there
that catches any jython exception and handles it in whatever way you wish.
This is the line of code that should be wrapped.

https://hg.python.org/jython/file/f79dc13778f9/src/org/python/util/PyServlet.java#l155

The traceback module should be useful to you.

http://www.jython.org/docs/library/traceback.html

Alan.


On Tue, Mar 10, 2015 at 12:30 PM, helix84 <[email protected]> wrote:

> PyServlet
>
> Meanwhile I found the stacktraces are logged
> in /var/log/tomcat8/localhost.`date +%Y-%m-%d`.log
>
> Still, during development I'd like them to show up in the page, so my
> question stands. Learning how to enable/disable it should also allow me to
> turn them off for applications in production on Tomcat 7.
>
>
> Regards,
> ~~helix84
>
>
> On Tue, Mar 10, 2015 at 1:15 PM, Alan Kennedy <[email protected]>
> wrote:
>
>> How are you embedding your jython code into Tomcat?
>>
>> Modjy?
>> PyServlet?
>> Some other mechanism?
>>
>> Is the code for that mechanism publicly available?
>>
>> Alan.
>>
>>
>> On Tue, Mar 10, 2015 at 9:20 AM, helix84 <[email protected]> wrote:
>>
>>> Hello,
>>>
>>> I just installed Tomcat 8 from Debian Jessie and found out that error
>>> reporting in jython behaves differently than in Tomcat 7.
>>>
>>> In my Tomcat 8, when there's a syntax error in my jython script, HTTP
>>> 500 status is returned and the stacktrace is in catalina.out. However, when
>>> the code raises an exception, a stacktrace is not returned, not logged and
>>> the connection is closed at that point. I reproduced this with both Jython
>>> 2.5.3 and 2.7b4.
>>>
>>> In Tomcat 7, HTTP 500 status with a stacktrace was returned and the
>>> stacktrace was written into catalina.out.
>>>
>>> Did anyone else notice this? Is it a configuration issue? Does it happen
>>> with upstream (non-Debian Tomcat)?
>>>
>>> Thanks in advance.
>>>
>>> Regards,
>>> ~~helix84
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Dive into the World of Parallel Programming The Go Parallel Website,
>>> sponsored
>>> by Intel and developed in partnership with Slashdot Media, is your hub
>>> for all
>>> things parallel software development, from weekly thought leadership
>>> blogs to
>>> news, videos, case studies, tutorials and more. Take a look and join the
>>> conversation now. http://goparallel.sourceforge.net/
>>> _______________________________________________
>>> Jython-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/jython-users
>>>
>>>
>>
>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.