log: fix backtrace not going to the --log-file #9014

Before the log re-organisation in:

8d353039a6 log: add log rotation to --log-file

rclone would write any backtraces to the --log-file which was very
convenient for users.

This got accidentally disabled due to a typo which meant backtraces
started going to stderr even if --log-file was supplied.

This fixes the problem.
This commit is contained in:
Nick Craig-Wood
2025-12-09 16:35:07 +00:00
parent 3dd0232a26
commit bc3305efd1

View File

@@ -209,7 +209,7 @@ func InitLogging() {
// Log file output
if Opt.File != "" {
var w io.Writer
if Opt.MaxSize == 0 {
if Opt.MaxSize < 0 {
// No log rotation - just open the file as normal
// We'll capture tracebacks like this too.
f, err := os.OpenFile(Opt.File, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0640)