Skip to content

Support for console-JSON and FILE logging#10576

Merged
pedroigor merged 1 commit intokeycloak:mainfrom
DGuhr:logging_v1_1
Mar 8, 2022
Merged

Support for console-JSON and FILE logging#10576
pedroigor merged 1 commit intokeycloak:mainfrom
DGuhr:logging_v1_1

Conversation

@DGuhr
Copy link
Copy Markdown
Contributor

@DGuhr DGuhr commented Mar 3, 2022

See logging.adoc for details on the usage

Closes #10523 #10607 and #10470

@DGuhr DGuhr force-pushed the logging_v1_1 branch 2 times, most recently from 17a74fd to aad6209 Compare March 4, 2022 08:41
@DGuhr
Copy link
Copy Markdown
Contributor Author

DGuhr commented Mar 4, 2022

note to self: squash the commits before moving out of draft state.

@pedroigor
Copy link
Copy Markdown
Contributor

@DGuhr LGTM. The config looks great for me.

@DGuhr DGuhr force-pushed the logging_v1_1 branch 2 times, most recently from 49fd42a to cd918f7 Compare March 4, 2022 15:45
@DGuhr DGuhr changed the title WIP Logging v1 1 Support for console-JSON and FILE logging Mar 4, 2022
@DGuhr DGuhr marked this pull request as ready for review March 4, 2022 15:46
@DGuhr DGuhr force-pushed the logging_v1_1 branch 3 times, most recently from 936aa5f to 653333f Compare March 7, 2022 08:51
andreaTP
andreaTP previously approved these changes Mar 7, 2022
Copy link
Copy Markdown
Contributor

@andreaTP andreaTP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
Added a few comments, but nothing major 🙂

@DGuhr DGuhr force-pushed the logging_v1_1 branch 2 times, most recently from 44d7c30 to ea48e1d Compare March 7, 2022 09:54
andreaTP
andreaTP previously approved these changes Mar 7, 2022
Copy link
Copy Markdown
Contributor

@andreaTP andreaTP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

pedroigor
pedroigor previously approved these changes Mar 7, 2022
@abstractj
Copy link
Copy Markdown
Contributor

abstractj commented Mar 7, 2022

@DGuhr @pedroigor Quarkus tests are failing in the CI, not sure if it's related with those changes. Maybe it's just the matter of a rebase.

@DGuhr
Copy link
Copy Markdown
Contributor Author

DGuhr commented Mar 7, 2022

@abstractj it is related. already told pedro not to merge yet, will investigate

@stianst
Copy link
Copy Markdown
Contributor

stianst commented Mar 7, 2022

@DGuhr I don't really like the color thing to be honest, as folks will enable logging, try to send it somewhere, then discover some issues with it, go back to docs and figure out they can disable color support. What about just removing color by default? Then in the future we can revisit if this is something folks want and rather have that something that can be enabled (instead of disabled)?

@DGuhr
Copy link
Copy Markdown
Contributor Author

DGuhr commented Mar 7, 2022

@stianst it's a trade-off. the code-change is one line, but let me explain my reasoning for leaving colored console logging the default:

Question for good UX imo is always what would most users want? Not all, but most. This should then be made the default, so they don't even have to think about it.

Different use cases are affected in this particular case:

  1. Reading logs when developing
  2. Reading logs on console when starting the "on-prem" dist
  3. Reading unstructured logs that are sent to ELK or sth (the case the color issue comes from)
  4. reading structured json logs sent to elk (in this case color is always off)

and i guess some more i forgot. but the 4 use cases still prove the point:

I think the usecases where colored logs are actually helpful far outweigh the edge cases where you want uncolored console logging as default, because more people will look and read the logs than will try to send them to [centralizedlogging] and having issues.

Lead me to:
colored unstructured console logs => default, because in most cases when you do unstructured logging easy readability is wanted, and most people get good readability ootb.
no color => edge case 3) is possible by using the switch. These fewer people have to look it up. yes.
structured => also available ootb.

So I would vote against making uncolored logs the default.

@abstractj abstractj requested review from andreaTP and pedroigor March 7, 2022 13:50
@stianst
Copy link
Copy Markdown
Contributor

stianst commented Mar 7, 2022

@stianst it's a trade-off. the code-change is one line, but let me explain my reasoning for leaving colored console logging the default:

Question for good UX imo is always what would most users want? Not all, but most. This should then be made the default, so they don't even have to think about it.

Different use cases are affected in this particular case:

  1. Reading logs when developing
  2. Reading logs on console when starting the "on-prem" dist
  3. Reading unstructured logs that are sent to ELK or sth (the case the color issue comes from)
  4. reading structured json logs sent to elk (in this case color is always off)

and i guess some more i forgot. but the 4 use cases still prove the point:

I think the usecases where colored logs are actually helpful far outweigh the edge cases where you want uncolored console logging as default, because more people will look and read the logs than will try to send them to [centralizedlogging] and having issues.

Lead me to: colored unstructured console logs => default, because in most cases when you do unstructured logging easy readability is wanted, and most people get good readability ootb. no color => edge case 3) is possible by using the switch. These fewer people have to look it up. yes. structured => also available ootb.

So I would vote against making uncolored logs the default.

I would believe in most cases in production folks do not read logs locally, and I shouldn't have to troubleshoot an issue with logging to figure out that it's caused by colored logs, to then figure out how to disable that. That is horrible UX IMO, and much worse than a developer not having some pretty colors in the logs.

@DGuhr
Copy link
Copy Markdown
Contributor Author

DGuhr commented Mar 7, 2022

@stianst let's agree to disagree here. I think we both do our best to provide good ux, based on our experiences, but in the end we are both just guessing here. I will change colors to being disabled by default, and lets see if people then complain or not. ;)

Should we label this an "unbreaking change" or a "breaking change" in the release notes? 😜 (Just joking)

@DGuhr DGuhr dismissed stale reviews from pedroigor and andreaTP via c9a48ff March 7, 2022 16:10
@DGuhr
Copy link
Copy Markdown
Contributor Author

DGuhr commented Mar 7, 2022

@stianst changed the default to have no colors now.

@abstractj @pedroigor Also found the missing piece to make the tests pass again (missed changing output format value from "plain" to "default" in the internal keycloak.conf when changing it in the propertymapper, this led to weird behaviours over and over). So from my perspective, when the CI gets green, feel free to merge :)

See logging.adoc for details on the usage

Closes keycloak#10523, keycloak#10607 and keycloak#10415
@pedroigor
Copy link
Copy Markdown
Contributor

Also agree colors should be disabled by default if that is what makes more sense for production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add File Log Support

5 participants