--log-file and --stats simultaneously


#1

Is it possible to have output to the screen and simultaneously to the log file?

I ask because if I use the output to log file I lose track of what is being done by the screen.

And if I do not use the output to the log file,I can follow the screen, but I lose the record of what was executed (the log file).

Am I missing any obvious setup?


#2

Erm, no, that isn’t possible right now!

What I normally do is use tee

rclone stuff | tee rclone.log

which will put stuff to the screen and to the log

Does that help?


#3

I didn’t know this tee (I have little experience with unix), I’ll take a look. Thank you!


#4

I tried running this command: rclone -v move --transfers=1 --bwlimit 50M “E:\Stuff” “gdrive:Folder” | tee “C:\RCLogs\rclone.log”, but the command error’d out saying that the tee command was not recognized. I’m running version rclone v1.38-031-gef134660.


#5

I guess you are using windows which doesn’t have tee by default. You can get one from msys2 however that is quite a learning curve in my experience.


#6

I agree. It does look like a learning curve. I am running rclone on Windows 10. Sorry I didn’t specify. Do you have an alternative command or suggestion that I can run to where I can get the output to a log file and print to the command prompt screen? Thank you for the help!


#7

According to a bit of searching PowerShell has a tee command which works just like the unix utility - that should be quite easy to use with only PowerShell to install.


#8

Awesome! I am a little familiar with Powershell. I will give this a whirl. Thank you again!


#9

What about now? Is it possible to use –log-file and –stats simultaneously on Windows 10?

When I do this in powershell:

rclone sync --dry-run "src" "remote":"folder" --log-level INFO --delete-after --copy-links | tee "C:\Users\user\Desktop\My Documents\log.log"

I get this error: Command sync needs 2 arguments maximum

As a work around, I can at least get the progress during transfer with: --stats-one-line -P --stats 5s

rclone sync --dry-run "src" "remote":"folder" --log-file "C:\Users\user\Desktop\My Documents\log.log" --log-level INFO --delete-after --copy-links --stats-one-line -P --stats 5s


#10

It looks like cobra or powershell has parsed your rclone invocation wrong… If I try that in bash it works fine.

If you change your log-level to DEBUG it should print something which looks like this

2018/10/10 12:51:18 DEBUG : rclone: Version "v1.43-139-g87ef3cc6-fix-2438-s3-v2-sign-beta" starting with parameters ["rclone" "sync" "--dry-run" "src" "remote:folder" "--log-level" "DEBUG" "--delete-after" "--copy-links"]

That will tell us how powershell parsed the line.


#11

I have changed the log level to DEBUG : I am still getting the same error and not log is created.

i forgot to write that I have rclone v1.43.1


#12

Can you try removing the flags one by one and see when it starts working? I think it is something to do with that.

I wonder if the quotes “remote”:“folder” is confusing it. Can you try “remote:folder”?


#13

Thanks for your help!

Yes the “remote”:“folder” is confusing it. When I replaced it with “remote:folder” it’s working ! I don’t have the error: Command sync needs 2 arguments maximum and rclone is doing the sync.

So we are making progress, but…

… rclone doesn’t create the "C:\Users\user\Desktop\My Documents\log.log". I tried creating the file log.log and then see if rclone would edit it, but no, it doens’t. After the sync, log.log is still empty. I verified the path and it’s the right one.

Any idea ?


#14

Rclone logs to stderr so to capture the log (assuming powershell works something like bash) you’d write this to send stderr to wherever stdout is going

rclone ...... 2>&1 | tee "C:\Users\user\Desktop\My Documents\log.log"

#15

Yes, that it’s! Thanks a lot ncw!
So for others in the same situation the right command is:

rclone sync --dry-run "path to local folder" "remote:folder" --log-level INFO --delete-after --copy-links 2>&1 | tee "C:\Users\user\Desktop\My Documents\log.log"

Don’t use this form "remote":"folder" but that one "remote:folder"