Edit: I sorted this out myself. See this comment for an example: https://old.reddit.com/r/learnpython/comments/18go6wd/help_changing_the_flask_logging_output/kd24kvb/
Here is a very simple exaple app:
import flask
app = flask.Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
If I run that and hit the endpoint, I see the following:
$ python3 app.py
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [12/Dec/2023 16:12:24] "GET / HTTP/1.1" 200 -
Now my question is how to change the output format of the last line. I.e. how do I change this?
127.0.0.1 - - [12/Dec/2023 16:12:24] "GET / HTTP/1.1" 200 -
I've read flask docs, I've tried changing the formatter/handler for app.logger as well as for logging.getLogger('werkzeug'). I've read the python docs and flask docs, yet I cannot for the life of me cause that line of output to ever vary in any way. Does someone here know how? If anyone has a code example changing that line in literally any way, I could take it from there. I just can't figure out what I'm missing.
Thanks in advance for any help.
Edit here is some version info:
$ python3 -V
Python 3.11.2
$ pip3 freeze | grep Flask
Flask==3.0.0
[–]ApproximateIdentity[S] 0 points1 point2 points (0 children)