feat:(logging) Added Log Format provision#8890
Conversation
|
So, all you've done is make the configuration valid in the configuration YAML file. Now, you have to plumb it through to change the actual logging behavior. And finally, you should write some tests to make sure it actually logs in JSON if you have the setting enabled. |
|
@timsehn Can you take a look whether I am heading in the right direction? |
|
You are heading in the right direction. It looks like you have most of the places to actually get the value to the server. Now the server needs to read it when it wants to emit a log line and emit the right format. @zachmu suggested that logic is here: Looking at logrus (https://github.com/sirupsen/logrus), it seems they have JSON formatting capability. IN their README, they suggest |
|
@timsehn I have configured the logger for log_format but i am not sure how can I test the same with a logger. Update:- |
|
That looks like it is working. I'm not sure the best way to write tests for this. @zachmu should answer. |
|
Hi @damanV5, This looks really good. You should add a test for the new option in the bats file here, similar to this one: You can check the output format is correct by redirecting the log to a file, like this test does: |
Can this very first line too be in json? |
|
Need to figure something out here, The following test is working fine for insensitivity when checked from command line but from config.yaml it is behaving sensitive. So, that I need to figure out. Test:- |
|
@zachmu Update: I managed to add a test case for |
|
Running tests now. |
|
Also, you must fix the Go tests this broke. |
|
It's odd that the Go tests passed with No race but failed with race on. |
|
@timsehn I have fixed the go tests for sqlserver. Do i also need to update |
|
Running tests again. |
timsehn
left a comment
There was a problem hiding this comment.
Just comments on the tests.
This may be an artifact of our automation. I think we're good. Just factor that test into two tests and I tghink we can take this contribution. Thanks for the hard work. |
|
@fulghum will give this a final review and get it merged. Thanks for the contribution. |
|
Thanks for the contribution @damanV5 🎉 |

Added
log_formatfeature for logger.