-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add Debug Mode configuration and move detailed logs to Debug log level #167
Conversation
pkg/authenticator/authenticator.go
Outdated
@@ -113,7 +113,7 @@ func (auth *Authenticator) GenerateCSR(commonName string) ([]byte, error) { | |||
// successfully retrieved | |||
func (auth *Authenticator) Login() error { | |||
|
|||
log.Info(log.CAKC007I, auth.Config.Username) | |||
log.Debug(log.CAKC007I, auth.Config.Username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this opens something up. we need to change CAKC007I
to CAKC007D
(or some other number) as the last letter indicates the log level. we have a few options here:
- Change the suffix for every message that we move from Info to Debug
- Remove the suffice altogether as the level is logged anyway in the same message.
- Leave these messages with the
I
suffix and not have aD
suffix at all (info and debug messages will have anI
suffix).
The second option is the most correct one imo, although it is different from how we log in other projects (conjur, CSPFK). However, option 3 is backwards-compatible and doesn't require a doc change (also - customers may be monitoring these messages).
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
I agree that option 2 looks the most correct way to go, but it made me think: Does it mean that there could be 2 different messages, one for info and one for debug, but with the same ID?
It might create conflicts that will be hard to resolve.
And between 1 and 3, I prefer to go with the convention to decide, which is option 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they won't have the same ID as one will be CAKC001I
and one will be CAKC001D
. we have the same thing with Error log messages. If we go for option 2 then we will need to restructure all the codes from the beginning and it will break compatibility.
Option 1 is ok as well but it us not fully backwards-compatible. For example, a customer may monitor the log for CAKC007I
but now it will change to CAKC007D
and they will never catch it.
Option 3 is the safest one regarding backwards-compatibility. It has its flaws but I would go in that direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just read the Semantic Versioning doc this project adheres to.
It explicitly says: Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.
Isn't it enough to allow the use of the 1st option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I also found this: https://semver.org/spec/v2.0.0.html#how-do-i-know-when-to-release-100.
@izgeri, why authn client wasn't released as 1.0.0 yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can go for option 1 but in that case then we can go with option 2. Which one do you prefer?
For both options I would add a CHANGELOG entry saying that the error codes were changed to enhance supportability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abrahamko I don't know, but I've raised this with PM a couple of times recently. We will have to find a time to have a smallish focused effort on this project to get it to 1.0.0. cc @Tovli
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great! I look forward to seeing the positive impact on Secretless logs from this change :)
left a couple of requested changes from the changelog
@izgeri the CHANGELOG master! |
@abrahamko / @orenbm / @izgeri Just doing a drive-by comment on this: |
709bc19
to
d44f405
Compare
A few comments on this based on some recent conversations:
|
Thanks @dataplex! I think we could add a separate issue for adding configuration info logs on container startup - that sounds like a reasonable idea. I would suggest for this PR we:
|
@abrahamko will you take this from here? when are you planning to do it? |
- Add configuration to allow Debug mode that will show detailed logs. By default, they will not be written, but can be added for investigation. - Change log level of detailed logs from Info to Debug
d44f405
to
b2f7da7
Compare
|
I opened issue #169 as a follow-up issue to write the configuration to the log. |
Log suffix is redundant, as it is written in the same line with the log. This allows the log level change from Info to Debug without impacting the log identifier.
d738ebf
to
c914688
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments. It's also worth noting that I ran golint ./...
against this branch and there were a number of issues - are there any that can be fixed as part of this PR?
@abrahamko can you update on this ticket? where does it stand? |
@orenbm I will do one last effort to finish. Otherwise it will have to wait to next R&D boost. |
@izgeri this PR diverged too much from its original purpose. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a suggestion for the change log entry - it's worth calling out that the error messages are changing for some errors with this PR
but other than that, this LGTM, so I'll approve this to remove my "request changes" on the PR
Co-authored-by: Geri Jennings <[email protected]>
What does this PR do?
By default, they will not be written, but can be added for investigation.
Most messages were moved to DEBUG, because INFO should be information on the operation that the invoker is interested in.
For authn client, this is the authentication.
It doesn't matter to him how it does it, only what it does, and when it is done or failed.
See the examples below for more info.
What ticket does this PR close?
Closes #134
Checklists
Change log
Test coverage
Documentation
README
s) were updated in this PR, and/or there is a follow-on issue to update docs, orExample of debug mode off (default):
Example of debug mode off (default) with errors:
Example of debug mode on