Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster autoscaler argument --log-file is no longer working after v1.30.x #7842

Open
linhua11 opened this issue Feb 14, 2025 · 1 comment
Open
Labels
area/cluster-autoscaler kind/bug Categorizes issue or PR as related to a bug.

Comments

@linhua11
Copy link

linhua11 commented Feb 14, 2025

Which component are you using?: Cluster auto-scaler

What version of the component are you using?: v1.31.1, v.1.30.2

What did you expect to happen?:
When in v1.29.4, we use log-file=/xxx to redirect log to redirect all the logs to a separate file for tracking

What happened instead?:
After upgrading to v1.30.x, the log file no longer exist, not even created

How to reproduce it (as minimally and precisely as possible):
just set

  • --logtostderr=false
  • --alsologtostderr=false
  • --stderrthreshold=INFO
  • --v=4
  • --log_file=/xxxx/cluster-autoscaler.log

Anything else we need to know?:
I have done some research on the issue, it should be related to this change: kubernetes/component-base@4bf35a2

So in klog.go, if the logger is not nil, it won't proceed to the log file creation part. However, in the above commit, it sets the logger factory and bypass klog. So no log file will be created.

For reference: in https://github.com/kubernetes/klog/blob/e7125f792ea66a85818cfb45261c9e1acc585344/klog.go#L861
if logger != nil {
if logger.writeKlogBuffer != nil {
logger.writeKlogBuffer(data)
} else {
.....
}
} else if l.toStderr {
os.Stderr.Write(data)
} else {
if alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() {
os.Stderr.Write(data)
}
if logging.logFile != "" {
// Since we are using a single log file, all of the items in l.file array
// will point to the same file, so just use one of them to write data.
if l.file[severity.InfoLog] == nil {
if err := l.createFiles(severity.InfoLog); err != nil {
os.Stderr.Write(data) // Make sure the message appears somewhere.
l.exit(err)
}
}
}

@linhua11 linhua11 added the kind/bug Categorizes issue or PR as related to a bug. label Feb 14, 2025
@adrianmoisey
Copy link
Member

/area cluster-autoscaler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cluster-autoscaler kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants