Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request - logger handle #155

Open
rotten opened this issue Sep 13, 2017 · 0 comments
Open

feature request - logger handle #155

rotten opened this issue Sep 13, 2017 · 0 comments
Labels

Comments

@rotten
Copy link

@rotten rotten commented Sep 13, 2017

It would be great if there was a logger handle that I could grab for Swagger to log accesses, errors, and debug information to my api system log.

I would hope for something similar to adding these other handlers to my app.

    # Set the log file name and log level with command line options
    logHandler = RotatingFileHandler(logPath, maxBytes=10000000, backupCount=10)
    logHandler.setLevel(logLevel)

    logHandler.setFormatter(Formatter('%(asctime)s %(levelname)s %(module)s.%(funcName)s: %(message)s '))

    werkzeugLogger = getLogger('werkzeug')
    werkzeugLogger.addHandler(logHandler)
    werkzeugLogger.setLevel(logLevel)

    waitressLogger = getLogger('waitress')
    waitressLogger.addHandler(logHandler)
    waitressLogger.setLevel(logLevel)

    app.logger.addHandler(logHandler)
    app.logger.setLevel(logLevel)
    # Prevent the log messages from going to stdout
    app.logger.propagate = False

    if logLevel == logging.DEBUG:
        app.config['SQLALCHEMY_ECHO'] = True
        app.debug = True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.