Creation of logs in a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 09:37 AM
Good afternoon.
I am trying to add logs in the creation of my code. The issue is that I haven't yet found a way to write the logs to a separate file, rather than having them output to the terminal; I want them to be stored in a file (example.log).
I have tried using basicConfig and specifying the path where I want to store the logs, but they are not being saved.
Could you help me? Am I missing some configuration, or do you know of any other way to store the logs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 10:08 AM
Hi @mac08_flo ,
Use logging library. You can configure to log to terminal, to files etc.
https://www.highlight.io/blog/5-best-python-logging-libraries