Skip to content

About

template python scripts

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

python_templates

This shows an example of how to use the timedRotatingFileHandler to rotate log files in Python.

Example

Run the Python script 'myapp.py'. This will generate a log entry in the log/ directory. Run the script again after 1 second. It will rotate off the previous log file.

  python myapp.py

You can change the frequency of log rotation by changing this variable in logging_config.ini. This example means the log file is rotated off every second, it keeps 5 old log files at most.

args=(os.environ['mylogfile'], 's', 1, 5)

About

template python scripts

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages