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

java-connectors: add thread name as part of the log message #35199

Merged
merged 6 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"message": {
"$resolver": "pattern",
"pattern": "%level %C{1.}(%M):%L %m",
"pattern": "%level %thread %C{1.}(%M):%L %m",
Copy link
Contributor

Choose a reason for hiding this comment

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

This being a user-visible change, it feels like it deserves an entry in the CDK changelog and therefore its own CDK version.

"stringified": true
},
"stack_trace": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void testAirbyteLogMessageFormat() throws java.io.IOException {
// validate that the message inside AirbyteLogMessage matches the pattern.
// pattern to check for is: LOG_LEVEL className(methodName):LineNumber logMessage
final String connectorLogMessageRegex =
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: consider using String.format or formatted instead of interpolating strings with +

"^INFO [\\w+.]*.AirbyteLogMessageTemplateTest\\(testAirbyteLogMessageFormat\\):\\d+ hello$";
"^INFO " + Thread.currentThread().getName() + " [\\w+.]*.AirbyteLogMessageTemplateTest\\(testAirbyteLogMessageFormat\\):\\d+ hello$";
Copy link
Contributor

Choose a reason for hiding this comment

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

Call Pattern.quote on the thread name to escape it properly for use in a regex.

final Pattern pattern = Pattern.compile(connectorLogMessageRegex);

final Matcher matcher = pattern.matcher(connectorLogMessage);
Expand Down
Loading