graphite-api icon indicating copy to clipboard operation
graphite-api copied to clipboard

Logging for python n00bs

Open swissdave opened this issue 10 years ago • 7 comments

Hi there, I'm trying to write a custom finder etc using graphite-api and all looks good util I get an exception from a render call. I get a 500 back to the browser:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

and in the Apache log:

[Fri Jul 10 15:17:13 2015] [error] No handlers could be found for logger "flask.app"

Is there a simple way to find out what the problem is? I'm using graphite-api 1.0.1 via pip (can't get install from source to work)

Thanks

swissdave avatar Jul 10 '15 13:07 swissdave

I added this to the config, but still no exception detail in the apache log or /var/log/graphite-api.log (file is empty)

logging:
  version: 1
  handlers:
    raw:
      level: DEBUG
      class: logging.StreamHandler
      formatter: raw
  loggers:
    root:
      handlers:
        - raw
      level: DEBUG
      propagate: false
    graphite_api:
      handlers:
        - raw
      level: DEBUG

swissdave avatar Jul 14 '15 08:07 swissdave

Current master returns tracebacks in the HTTP response in case of app errors. Can you give it a try?

brutasse avatar Oct 05 '15 14:10 brutasse

Thanks, but I could only get it to work at all via pip (i.e released version). I got a load of dependency-related problems when I tried to do it from source.

On 05 Oct 2015, at 16:21, Bruno Renié [email protected] wrote:

Current master returns tracebacks in the HTTP response in case of app errors. Can you give it a try?

— Reply to this email directly or view it on GitHub.

swissdave avatar Oct 05 '15 16:10 swissdave

Cool, graphite-api 1.1 was just released and it contains that change.

brutasse avatar Oct 05 '15 16:10 brutasse

@swissdave did you have the opportunity to try a newer version?

brutasse avatar Oct 23 '15 14:10 brutasse

Hey - sorry, been a bit busy with other stuff.. will try to take a look next week..

On 23 Oct 2015, at 16:34, Bruno Renié [email protected] wrote:

@swissdave https://github.com/swissdave did you have the opportunity to try a newer version?

— Reply to this email directly or view it on GitHub https://github.com/brutasse/graphite-api/issues/118#issuecomment-150591615.

swissdave avatar Oct 23 '15 18:10 swissdave

Yep, got the python trace back now - much easier to debug, thanks!

Is this how I should debug generally? I am still logging into the Apache logfile using print statements which doesn't feel quite right, and still get the "No handlers could be found for logger "flask.app" errors..

swissdave avatar Dec 14 '15 13:12 swissdave