-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log level options #123
Comments
I ran into this same issue. The problem appears to be that each module gets it's own logger, but the log-level option only sets the log level in the logger used in base.py. As a result, that logger logs at the correct level, but the other modules all don't have the value set correctly. I have a quick hack level fix that returns the same logger to all the modules, so the logging level is set correctly universally. It's a hack, but it does the trick. |
@koldinger what is your fix? I am making a cronjob that will email output. Don't want it being 15 thousand lines long. Only want to see errors. Thanks! ----- edit ----- I decided to make a script that outputs to a log file and then I remove all lines that contain "already exists" and then it sends me an email once a day. Here is what I have for those wondering. You must already have a Here are 2 sites that helped me with setting up exim4 Script installed at
#!/usr/bin/env bash
# start a timer
start=$(date +%s);
# clear previous run from log file
sudo cp /dev/null /opt/icloud_photos_downloader_scripts/backup_jesse.log
# run script to grab all photos/videos and output to log file
sudo python /opt/icloud_photos_downloader/icloudpd.py --username [email protected] --password icloudpassword --directory /mnt/media/icloud_backups/jesse/ --size original --live-photo-size original --smtp-host smtp.gmail.com --smtp-port 587 --smtp-username [email protected] --smtp-password mypassword --notification-email [email protected] --no-progress-bar --log-level error > /opt/icloud_photos_downloader_scripts/backup_jesse.log
# remove the lines that output a file already exists so we only see what new files were added
sudo sed -i "/\b\(already exists\)\b/d" /opt/icloud_photos_downloader_scripts/backup_jesse.log
# stop timer and calculate runtime
end=$(date +%s);
runtime=$((end-start));
hours=$((runtime / 3600));
minutes=$(( (runtime % 3600) / 60 ));
seconds=$(( (runtime % 3600) % 60 ));
duration="Runtime: $hours:$minutes:$seconds (hh:mm:ss)"
# prepend the log file with the runtime so we see it first in the email
sudo sed -i "1s;^;$duration\n;" /opt/icloud_photos_downloader_scripts/backup_jesse.log
# send the email
sudo mail -s 'iCloud Backup Report - Jesse' [email protected] < /opt/icloud_photos_downloader_scripts/backup_jesse.log
|
Currently the script is not logging "ERRORS" in any separate way. What exactly would be your expectation which messages should come out an which not? Maybe we could put something together? Or are you already happy with @Kryptonit3-zz 's script solution? |
It looks like, though the documentation for icloudpd on GitHub suggest that there's an "error" option for log-level, that it doesn't function and instead outputs debug and info messages as well.
Being a novice coder at best, I'm not quite sure, but when poking around icloud_photos_downloader/icloudpd/logger.py, it looks like there's actually no "error" option.
Could that be causing my problem? If so, should/can that option be added?
The text was updated successfully, but these errors were encountered: