Repository: traefik/traefik (language: go)

Issue:
In v3.0 logs go to STDERR instead of STDOUT
### Welcome!

- [X] Yes, I've searched similar issues on [GitHub](https://github.com/traefik/traefik/issues) and didn't find any.
- [X] Yes, I've searched similar issues on the [Traefik community forum](https://community.traefik.io) and didn't find any.

### What did you do?

I spent a small chunk of time trying to figure out how to separate application logs from access logs when both are enabled.  The documentation for both logs and access logs say "By default, logs are written to stdout, in text format.", but in reality, application logs are written to stderr by default.

### What did you see instead?

Application logging goes to stderr by default, not stdout.  This would just be nice to have documented properly.

### What version of Traefik are you using?

Version:      3.1.1
Codename:     comte
Go version:   go1.22.5
Built:        2024-07-30T13:55:22Z
OS/Arch:      linux/amd64


### What is your environment & configuration?

Relevant environment variables:
```
        TRAEFIK_LOG         = "true"
        TRAEFIK_LOG_LEVEL   = "DEBUG"
        TRAEFIK_ACCESSLOG              = "true"
```

### If applicable, please paste the log output in DEBUG level

_No response_


Discussion / hints:
Hey @jhitt25,
Thanks for your feedback, this is clearly a bug that will be fixed ASAP.
The documentation is correct, but the behavior isn't, logs should definitely go through STDOUT.

Fix patch:
diff --git a/cmd/traefik/logger.go b/cmd/traefik/logger.go
index c4f6c9dc18..8ba6ac6826 100644
--- a/cmd/traefik/logger.go
+++ b/cmd/traefik/logger.go
@@ -46,7 +46,7 @@ func setupLogger(staticConfiguration *static.Configuration) {
 }
 
 func getLogWriter(staticConfiguration *static.Configuration) io.Writer {
-	var w io.Writer = os.Stderr
+	var w io.Writer = os.Stdout
 
 	if staticConfiguration.Log != nil && len(staticConfiguration.Log.FilePath) > 0 {
 		_, _ = os.OpenFile(staticConfiguration.Log.FilePath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0o666)


Test patch: