In dry-run-mode, the log file does not contain changed/ updated regular files, and no deletions at all. It only contains changed and created directories. Yet, when executed without dry-run, the log file does contain all kinds of changes.
A small example: When running the command
rsync -a --delete-delay --progress --itemize-changes --stats --dry-run --log-file="/tmp/rsync-dry.txt" /tmp/mySource/ /tmp/myDest/
the log-file looks like this (3 items, all of them related to directories):
2015/08/26 17:18:04 [5812] building file list
2015/08/26 17:18:04 [5812] .d..t...... ./
2015/08/26 17:18:04 [5812] .d..t...... sub1/
2015/08/26 17:18:04 [5812] cd+++++++++ sub2/
2015/08/26 17:18:04 [5812] Number of files: 11 (reg: 8, dir: 3)
2015/08/26 17:18:04 [5812] Number of created files: 5 (reg: 4, dir: 1)
2015/08/26 17:18:04 [5812] Number of deleted files: 4 (reg: 3, dir: 1)
2015/08/26 17:18:04 [5812] Number of regular files transferred: 6
...
Without dry-run, i.e.
rsync -a --delete-delay --progress --itemize-changes --stats --log-file="/tmp/rsync-wet.txt" /tmp/mySource/ /tmp/myDest/
the log-file looks like this (13 items):
2015/08/26 17:19:44 [5837] building file list
2015/08/26 17:19:44 [5837] .d..t...... ./
2015/08/26 17:19:44 [5837] >f.st...... Bbb.txt
2015/08/26 17:19:44 [5837] >f+++++++++ Ccc.txt
2015/08/26 17:19:44 [5837] .d..t...... sub1/
2015/08/26 17:19:44 [5837] >f.st...... sub1/Fff.txt
2015/08/26 17:19:44 [5837] >f+++++++++ sub1/Ggg.txt
2015/08/26 17:19:44 [5837] cd+++++++++ sub2/
2015/08/26 17:19:44 [5837] >f+++++++++ sub2/Iii.txt
2015/08/26 17:19:44 [5837] >f+++++++++ sub2/Jjj.txt
2015/08/26 17:19:44 [5837] *deleting sub3/Kkk.txt
2015/08/26 17:19:44 [5837] *deleting sub3/
2015/08/26 17:19:44 [5837] *deleting Ddd.txt
2015/08/26 17:19:44 [5837] *deleting sub1/Hhh.txt
2015/08/26 17:19:44 [5837] Number of files: 11 (reg: 8, dir: 3)
2015/08/26 17:19:44 [5837] Number of created files: 5 (reg: 4, dir: 1)
2015/08/26 17:19:44 [5837] Number of deleted files: 4 (reg: 3, dir: 1)
2015/08/26 17:19:44 [5837] Number of regular files transferred: 6
...
which accurately reflects what rsync is doing.
I am puzzled because I believed that the output of rsync with and without --dry-run should be the same. (Otherwise, what would dry-run be good for?) The problem refers to the log-file only. The terminal output is always complete, with or without --dry-run.
I tried different options, e.g. --rtgopl or -rtgo instead of -a, -v instead of -i. I tried rearrangig the flags. I tried adding options like -c or --inplace. Didn't help. It also does not matter whether the destination is another local path (as in the example), a USB-drive or a remote destination via ssh. What did I do wrong? Or is rsync supposed to work like this? (I am using Ubuntu 14.04, rsync version 3.1.0.)