In an effort to clean up my python logging practices when creating libraries, I 
have begun reading into "Advanced Logging" and converting my logging practices 
into logging configuration `.ini` files:

[link](https://docs.python.org/3.4/howto/logging.html#configuring-logging)

My question is: When defining a FileHandler in a `.ini` file, all of the 
examples that I've seen hardcode the name and location of the log file. In the 
code snippet below, `python.log` is hardcoded into the `.ini` file:

```
[handler_hand02]
class=FileHandler
level=DEBUG
formatter=form02
args=('python.log', 'w')
```
[code reference 
link](https://docs.python.org/3.4/library/logging.config.html#logging-config-fileformat)

Desired Behavior:
On each run of the program, a new logfile is created in the `logs/` directory 
named "<timestamp>_program.log".

Current Behavior: 
The format in the example above overwrites a single file called "python.log" on 
each run, which is not the desired behavior.

Question: Is there a standard procedure for using .ini files to create a new 
logfile prepended with the current Unix timestamp on each run of the program?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to