-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
logging framework #6284
Comments
what would you log ? |
I thought we all came accross a usecase where we put a
Putting a
For this purpose, and maybe others that are just currently not that important, I think it would make sense to use a logging framework. |
For the purpose that you describe, I often have very specific things that I want to log to fix the issue. I tend to use |
Would it be needed to remove all the logs again? I could imagine that at least part of the logs do not destroy readability. Maybe they even improve it. |
I want my logs to be extremely specific and not include anything that someone else added because they were debugging another problem. That's mostly why I don't a bunch of random log calls throughout the code. I'll rephrase it with a question: what logging would you add that would be generally helpful for fixing most issues? |
Lets take an example: The |
That shouldn't be a problem, if you ever run into a problem where doing that is interesting. I'd rather argue that strace is not "generally helpful for fixing most issues", so let's not do strace in CI! :P |
I worked out two proposals:
Please have a look and tell me if you see any no-goes and if you have a favorite. |
Let's consider three scenarios:
So I'm asking a similar question to what sylvestre asked: What would you log? In which scenario would that help? You already mentioned that |
yeah, i am not convinced. (doesn't help with the CI) |
Thanks for the feedback and sharing experience about different strategy. Nevertheless I'm still convinced that the logfile is actually superior to the eprintln solution. Simply because it doesn't polute the stderr output that quite often is subject to asserts in test. @BenWiederhake I get from your response that potential performance impact and additional dependecies might be seen as no-goes due to the percieved low usefullness. To improve the benefit/harm relation, I did a 3rd solution proposal: #6315 . This way, the harmfullness goes to zero and the benefit to infinity ;-) |
Hey @cre4ture! I'd like to take a quick step back and evaluate for a bit. I wish you would've discussed this more before making all these implementations. It's great to see that you're passionate about this, but the problem is that you then put in a lot of effort, which makes it harder for us to reject this. Additionally it split the conversation over multiple pages and feedback on the PRs gets conflated with feedback on the issue. We should have talked about the concept first here in this issue and what the parameters are before moving on to the implementation. That makes the discussion usually much more friendly and easy :) This is on us as maintainers as well by the way. We probably should have been more clear about that. So, now, to return to the general purpose of logging. I'd like to return the discussion to this issue and I'm not gonna respond to the PR for the moment. Okay, step back taken, let's dive in :) Let's start with the fundamental questions:
"What" is usually quite specific to the application and I think it's hard to define that clearly in general. That gets to a problem with logging in the coreutils: they are all different and a general strategy is hard to define. Hence, I fear that the logging becomes arbitrary and not very useful (as I have already stated before). "When" can be during testing and debugging only, or exposing it to the end user. This can actually be useful for generating bug reports, but of course comes with a runtime cost. For the coreutils, I therefore think that the answer is "during debugging only". Alright, then how do we want to enable logging? Via a feature flags makes sense, so let's indeed roll with that. Now, you've brought up something interesting: we have to check both stdout and stderr in tests. This means that we don't have a channel for debug logging without breaking tests. And I agree that's a problem! For me personally then. All I want is a way to log things to a third channel for temporary debugging. I then don't want to keep those logs around after merging the PR. So I think it should be impossible to use the logging infrastructure when the feature flag is not enabled or there should be a big warning if you keep them around. We could, for example, (ab)use the So I think the requirements that I personally want for this are:
And this is where I come back to your PR, because it's doing pretty good on those requirements! I've checked the ones that it meets. So, from my perspective, it can almost be merged, apart from that second point. Is this something that you agree with? |
Hey, @tertsdiepraam I did a further change to address the last missing check in your list. Here is the current version #6315. It still has some Hoping for positive feedback. |
Indeed, I think that CI check should not be needed! Thanks! |
Should we introduce a framework for logging debugging information in the uutils?
In my eyes it would make debugging of issues in general but especially on CI much easier.
I think there should then also be the option to enable logging during CI runs and provide the log-output automatically after a failed test.
Technically, I think we should use rusts default logging facade mechanism with a logging backend e.g. "log4rs".
https://github.com/rust-lang/log?tab=readme-ov-file#log
I started already experimenting.
What do you think?
The text was updated successfully, but these errors were encountered: