-
Notifications
You must be signed in to change notification settings - Fork 101
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 contentLogLevel task property #193
Conversation
It appears the existing logging is at DEBUG logging level. This new option dont mention this fact so I would assume end users think its logged at INFO logging or always. Also it may not only be message body that has sensitive data. Headers can contain autorization tokens, usernames etc. So its probably better to have this option for all of it or nothing. |
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 must be applied on all the entity in the exchange not body only
core/src/test/java/org/apache/camel/kafkaconnector/CamelSourceTaskTest.java
Outdated
Show resolved
Hide resolved
Yes now is at DEBUG level, which is often set when debugging issues. The proposed option logs at INFO level only if the user explicitly set
It's actually including all of this, maybe the option name is not clear enough. I'm open to suggestions for better wording. |
You can also have the option about the logging level, we do this in Camel, then you can set it to DEBUG, INFO, OFF etc |
Good idea. Will do that. |
core/src/test/java/org/apache/camel/kafkaconnector/CamelSourceTaskTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnectorConfig.java
Outdated
Show resolved
Hide resolved
For the Thread.sleep I'm already opening a PR using Awaitility |
btw for logging you can use CamelLogger that can do the INFO, DEBUG, OFF etc |
Thanks |
Added the log option at the record level. Build is failing because of that flaky test that @oscerd is fixing with another PR. If we want to use the logging level instead of the boolean parameter, then I would need to create an utility class with a switch-case method to not hard-wire knowledge of what logging system is behind the slf4j facade. In that case we could set it to OFF by default. |
@fvaleri can you please rebase this PR on |
@valdar done, but I still see random build failures:
|
Yep, I will look into it, prepare to more rebases :D |
Yeah no problem, I'm using the following simple script to test and in addition to
|
I fixed |
Sent my proposal on a dedicated PR, hope it's useful. |
@fvaleri can you rebase this on master (again 😞 ) so we (finally 🥳 ) get it merged? |
Sure let me do it. I'm quoting myself here with a different approach, but I would need to explore it. What do you think? |
@fvaleri if you want to look into use the log level instead of a boolean you are welcome to do so; before writing your own utility class though, take a look at what @davsclaus suggested: https://github.com/apache/camel/blob/master/core/camel-api/src/main/java/org/apache/camel/spi/CamelLogger.java it might have all the pieces you need. |
@valdar I think it's a better approach but I need to find some time to play with it. Bear with me, I will update this PR. |
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.
In the end have you decided to not use CamelLogger
? I am not implying is wrong, I am just asking.
core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java
Outdated
Show resolved
Hide resolved
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.
LGTM
Thanks for the contribution @fvaleri ! |
We should not log record's payload by default, as it may contain sensitive information. Anyway it is useful to have a configuration option to enable/disable it for debugging purpose.
Proposing new boolean config named
camel.source.logPayload
.