-
Notifications
You must be signed in to change notification settings - Fork 96
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 not working #47
Comments
Having the same issue, was a solution ever found? |
Not by me... |
I also have this issue.... if I run manually the log tries to write but the date is not prepended:
I typically run this from roots cron:
So I am not getting a log file anywhere (that I can find) and def not where I configure it to write to. [snapraid]
; path to the snapraid executable
executable = /usr/bin/snapraid
; path to the snapraid config to be used
config = /etc/snapraid.conf
; abort operation if there are more deletes than this, set to -1 to disable
;deletethreshold = 250
deletethreshold = -1
[logging]
; log path to write to
filepath = /home/name/snapraid/log/
; logfile to write to, leave empty to disable
file = _Snapraid-runner.log
; maximum logfile size in KiB, leave empty for infinite
;maxsize = 5000 I can redirect to a log file....but something is off the native functionality to write a log is not running....below is my output from my redirected log.
I looked inside snapraid-runner.conf and snapraid-runner.py I am guessing this section has the logging:
and this is the section that says if you have the variable defined in your config file you should log:
So as you can see from my config file (and the other example in this thread) they are populated so the logging SHOULD be happening AND putting in the date and time. It looks like asctime is not working? or maybe something in
|
I brute forced around this until an RCA can be found...updated my crontab to redirect...not graceful but it works...not sure I need to cd into the dir first (I actually doubt it). For anyone that stumbles upon this it can work for now.
|
...my work around works when run manually but not through cron....still looking |
I'm having this issue too. The log works just fine if I run manually but does not work if run by cron. I'm on ubuntu 22.04. Manual command:
Crontab command (under root user):
Snapraid-runnner config:
All of this was working until recently so I'm not sure if the cause is in the snapraid-runner code or something has broken elsewhere. Also the email notification log looks correct. Edit: FIXED! The issue is caused by python buffering If you run the cronjob unbuffered then file logging works again. Just add -u to your cronjob like this:
One small snag though - on ubuntu this caused the file to be created in the root user's home directory so I had to change the logging file location to the full path not just file = snapraid.log as above. |
Are you sure the -u made any difference there? I would strongly assume that it has always written the log file in the root home – that's what you specified in your config after all. |
Previously it had all been working and was writing to the user home even though it was running under root cron but with the regular user logged in too. Anyway with -u and the full path specified its all working like before so I'm not going to mess with it. |
i think the 'issue' here is that the file gets saved to the root home. once i took a look there, i found my up to date log files and older ones (5000 kb snapraid.log.1, snapraid.log.2, etc. so good to clean up once in a while).
will report back. i might let it point to my (user) home folder if this doesn't work as expected. p.s. i did not use "-u" in any of my python commands. it works fine without and (as expected?) saves in the root home dir. |
Hi,
my snapraid-runner instance is not writing to log.
My /opt/snapraid-runner/snapraid-runner.conf:
[logging]
; logfile to write to, leave empty to disable
file = /home/mikulik86/snapraid.log
; maximum logfile size in KiB, leave empty for infinite
maxsize = 50000
What am I doing wrong?
The text was updated successfully, but these errors were encountered: