--log-file and --stats simultaneously

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?

1 Like

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?

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

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.

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.

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!

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.

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

1 Like

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

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.

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

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”?

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 ?

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"

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"


This works for me:

screen -dmS rclone-01 bash -c 'rclone sync --progress --log-level INFO --log-file /root/.config/rclone/upload.log /local rclone-01:/rclone-01 2>&1 | tee /root/.config/rclone/rclone-01.log'

This is the full command:

screen -dmS rclone-01 bash -c 'rclone sync --bwlimit 6M --progress --checksum --no-update-modtime --transfers 10 --checkers 8 --tpslimit 10 --update --filter-from /root/.config/rclone/filter-file.txt --drive-acknowledge-abuse --drive-pacer-burst 50 --drive-use-trash=false --log-level INFO --low-level-retries 30 --log-file /root/.config/rclone/upload.log /local rclone-01:/rclone-01 2>&1 | tee /root/.config/rclone/rclone-01.log'

You don't need to use screen to achieve the goal, but I recommend using it anyway.

on windows try this
start /w rclone.exe
start rclone.exe