python - Cannot get logging work for Flask with gunicorn daemon mode -


I'm running a flask web app using gunicorn + Nginx. I run Gonochorn in the Daemon mode. I configured the GunQurn and NGNix to log my files and error in the files but I can not get the flask log in just one file.

I use a shell file to start my app with Guntoorn:

  #! / Bin / bash Export VIRTUAL_ENV = "/ to / virtual / path" export path = "$ VIRTUAL_ENV / bin: $ path" source "$ VIRTUAL_ENV / bin / activate" name = "Hello" NUM_WORKERS = 1 Executive gunicorn Hello: App \ --name $ NAME \ - workers $ NUM_WORKERS \ --log level = debug \ --daemon \ --pid $ VIRTUAL_ENV / log / pid_gunicorn \ --access-logfile $ VIRTUAL_ENV / log / access_gunicorn.log \ --error -Logfile $ VIRTUAL_ENV / log / error_gunicorn.log  

And in my flop application I need to add login as per document:

  app .debug = False ... Aug __name__ == '__main__': app.debug = true, then: Import importing from logging.handlers RotatingFileHandler handler = RotatingFileHandler ("flask.log", maxBytes = 10000, backupCount = 1) handler.setLevel (logging.DEBUG) App.logger.addHandler (handler) App.logger.debug ("test !!") app.run ()  

I have other code in app.logger.debug also added.

When I start gunicorn without - daemon , the logging file works fine but once I - daemon Adding does not generate any logs.

I tried using print but it only works without - daemon as well.

I've searched for a while and does not support GunQuarna application logging. But I thought logging in the file would be okay?

Do anyone know how I can log out of a file under my settings?

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -