-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
add new log output formatting and asf trace logging #6424
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
Conversation
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 (since I wrote some of it :D)
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.
Looks awesome, great set of changes @thrau @dfangl ! 💯
Just gave this a quick try with the SQS event source polling, and a few other use cases - nice approach with LS_LOG=trace
and LS_LOG=trace-internal
, so we don't need to manually define specific logger rules for the internal calls.. 👌 Excited to get this in!
# x.x.x requires 5 = 2n - 1 characters | ||
cur_length = (len(parts) * 2) - 1 | ||
|
||
for i in range(len(parts)): |
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.
Nice algorithm!
MAX_THREAD_NAME_LEN = 12 | ||
MAX_NAME_LEN = 26 | ||
|
||
LOG_FORMAT = f"%(asctime)s.%(msecs)03d %(ls_level)5s --- [%(ls_thread){MAX_THREAD_NAME_LEN}s] %(ls_name)-{MAX_NAME_LEN}s : %(message)s" |
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.
nit: Great to have the thread information also available in the logs, although potentially we could think about adding that to the trace
-enabled logs only. Just a thought for future iterations, let's see how things are evolving with having the thread info in all logs for now.. 👍
This PR overhauls log formatting and restructures the setup routine of the logs a bit
localstack.logging
format.py
)Not super happy with the
LS_LOG=trace|trace-internal
solution. But I did my best to use what was already there and not introduce additional/different configuration.LS_LOG=trace|trace-interal
LS_LOG=trace-internal
AWS sqs.ListQueues => 200
), but we add in the same line the request dictionary and the headers (ListQueueRequest({}, headers={..http-headers..}
), and the response also with the headers (ListQueueResponse(...)
). this keeps everything neatly in one lineDemo
Here you can see trace logging in action: