pageauc / pi-timolo

Raspberry PI-TIMOLO ( PI-TImelapse, MOtion, LOwLight ) uses RPI picamera and OpenCV for Remote Headless Security Monitoring using Motion Tracking, Rclone Auto Sync files with remote storage services. Auto Twilight Transitions and Low Light Camera Settings. Panoramic images using PanTiltHat and More. This project is featured on GitHub Awesome software.
MIT License
553 stars 102 forks source link

log-file path #32

Closed ozett closed 7 years ago

ozett commented 7 years ago

hi, i tried you pi-timolo. i found it gread successor over motioneye or http://elinux.org/RPi-Cam-Web-Interface#Construction_of_a_Pi_Zero_Security_camera as it runs considerable stable on my raspi1.

i am now playing with it, and i am missing an option to configure the log-file path. may you want to code this in?

would be fantastic, thanks for your work. tozett

pageauc commented 7 years ago

Recently made changes to use python logging library. The logFilePath is hard coded on line 30 of pi-timolo.py ver 2.97. log file is writen to the current folder that pi-timolo.py was launched from and the name of the python file eg pi-timolo (or if it is called something else then the name of the python file without the extension). per line 30 code below

logFilePath = os.path.join(baseDir, baseFileName + ".log")

This could be easily changed to read setting from a config.py variable but at this time it is simply derived per code line above. Please note logging to a file only works if config.py settings are set per below

verbose = True
logDataToFile = True

Also Logging to a file only works from a console session when pi-timolo.py is run per

./pi-timolo.py

You cannot use pi-timolo.sh to launch pi-timolo.py as a background task, since output will be directed to a null file and no disk log file will be created or updated. Make sure permissions are correct since pi user cannot overwrite a log file owned by root. This could accidentally happen if pi-timolo.py is run by sudo. Also be aware that a new log file is created when program is restarted.

This feature was only designed for debugging or testing purposes when you need to fine tune settings for motion, night etc. It is expected that if you are running pi-timolo.py and/or webserver.py as background tasks that verbose and logging to disk would be disabled since it creates extra SD card writes and IO that could slow things down

Let me know if this explains things. If you need to setup a logging path manually you can simply override line 30 of pi-timolo.py eg

logFilePath = "/home/pi/mylogs/pi-timolo.log"