Stop tracebacks being sent with 500 error

1,113 views
Skip to first unread message

John Aherne

unread,
Aug 18, 2010, 11:21:15 AM8/18/10
to cherrypy-users
I have tried what I think are all the option to stop tracebacks being
sent when I get an uncaught exception.

in conf I have put
server.show.tracebacks = False
request.show_tracebacks = False

I also have put in this app request

app.request_class.show_tracebacks = False

But regardless, they keep coming through

This is cherrypy 3.1.2
WINXP SP3
python 2.5.4

Is there some secret code I am missing

i do want to log and email tracebacks for uncaught exceptions, which I
have working. But I don't want them sent to the users


Thanks for any info

John Aherne

Anders Langworthy

unread,
Aug 18, 2010, 12:10:54 PM8/18/10
to cherryp...@googlegroups.com
On Wed, Aug 18, 2010 at 11:21 AM, John Aherne <jjah...@gmail.com> wrote:
> I have tried what I think are all the option to stop tracebacks being
> sent when I get an uncaught exception.

I usually just set environment to 'production', which handles all of
the necessary config knobs for you to stop tracebacks from being shown
(in addition to other useful stuff).

A look in the cherrypy source suggests that the following are the
settings triggered by the "production" environment by default:

'engine.autoreload_on': False,
'checker.on': False,
'tools.log_headers.on': False,
'request.show_tracebacks': False,
'request.show_mismatched_params': False,
'log.screen': False,

If you have those set already, perhaps something is borked in the way
you are applying your current config?

Cheers,
Anders.

Eric Larson

unread,
Aug 18, 2010, 12:36:24 PM8/18/10
to cherryp...@googlegroups.com
At Wed, 18 Aug 2010 08:21:15 -0700 (PDT),

Have you tried setting 'environment': 'production'? I'm pretty sure
that the default is 'development' which will send the tracebacks
instead of a simplified 500 error.

Eric

> Thanks for any info
>
> John Aherne
>

> --
> You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
> To post to this group, send email to cherryp...@googlegroups.com.
> To unsubscribe from this group, send email to cherrypy-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en.
>

John Aherne

unread,
Aug 19, 2010, 2:36:01 AM8/19/10
to cherrypy-users
Eric

Thanks for the reply.

Yes I have tried setting the environment to production and I get the
same result. Tracebacks still coming through.

Guess I will keep hunting. I must be doing something simple but just
plain wrong.

John Aherne

John Aherne

unread,
Aug 19, 2010, 2:49:19 AM8/19/10
to cherrypy-users
Eric

Just thought I would show how my conf looks when it gets read in.

I just print out the contents so I can see what it thinks the settings
are while running.

E:\cherry_test>conf {'tools.trailing_slash.on': True,
'request.show_tracebacks': False, 'server.thread_pool': 10,
'log.screen': True, 'tools.log_tracebacks.on': True,
'server.socket_port': 8082, 'server2.socket_port': 8081,
'log.access_file
': 'e:\\logs\\cherry_access.log', 'server2.socket_host': '0.0.0.0',
'server.socket_host': '0.0.0.0', 'server.environment': 'production',
'tools.log_headers.on': True, 'log.error_file': 'e:\\logs\
\cherry_error.log'}
version 3.1.2
app {'info': '1', 'sender': 'ROCS', 'valid_time': 5, 'uname':
'john@someurl', 'upass': 'somepass', 'proxy': None, 'test': '1',
'allowLongMsg': False}


As far as I can see I am doing the right thing.

Can't see any typos.


On 18 Aug, 17:36, Eric Larson <e...@ionrock.org> wrote:

John Aherne

unread,
Aug 19, 2010, 3:16:40 AM8/19/10
to cherrypy-users
Anders

Thanks for the reply.

Looked through all the settings again.

They all look ok.

Tried adding some extra ones as per the production setting but no
deal.

I must be overriding them somehow as you suggest

John



On 18 Aug, 17:10, Anders Langworthy <lagrang...@gmail.com> wrote:

Christian Wyglendowski

unread,
Aug 19, 2010, 9:24:17 AM8/19/10
to cherryp...@googlegroups.com
Try this example, see if it works for you. It works here.

http://a.libpa.st/lQu1Z

Christian

John Aherne

unread,
Aug 19, 2010, 3:34:02 PM8/19/10
to cherrypy-users
Christian

Thanks

I'll give that a go.

John

John Aherne

unread,
Aug 21, 2010, 6:34:59 AM8/21/10
to cherrypy-users
Christian

Thanks. That works.

I found out my problem. It was my head.

It was working correctly all the time. I was just looking at the wrong
stuff for the return.

It's too embarrassing to explain..

JohnAherne



On 19 Aug, 14:24, Christian Wyglendowski <christ...@dowski.com> wrote:
Reply all
Reply to author
Forward
0 new messages