-2

Currently I am using the print function to write log messages:

print("...creating new data...")

(I am using the docker image tiangolo/uvicorn-gunicorn-fastapi:python3.7 to run my service).

But in the standard log I can see only the last few messages. I want to archive my log messages over days and month.

How is it possible to write a message in Python in a separate log file?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Ralph
  • 4,500
  • 9
  • 48
  • 87

1 Answers1

-2

You can use logging. Here an example

Nabil
  • 1,130
  • 5
  • 11