Closed lmolkova closed 6 months ago
Logging code generated by codegen has 2 patterns.
Case 1 is throw LOGGER.logExceptionAsError(new IllegalArgumentException(
This would be changed to throw LOGGER.atError().log(new IllegalArgumentException(
Case 2 is LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured.");
This would be changed to LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured.");
(there appears not a candidate key value to set, as the pipeline is an object)
@lmolkova @srnagar Let me know if above looks good to you.
Thanks for checking, @weidongxu-microsoft ! This came up in the discussions around generic core and future plans. @srnagar do you think there is a benefit in changing these current occurrences of logs - using different overloads doesn't seem to bring any immediate benefit.
Structured logging is supported in azure-core and generic-core: https://github.com/Azure/azure-sdk-for-java/wiki/Logging-in-Azure-SDK
Structured logging allows to:
As a result, logs become query-able and aggregate-able.
Whenever we generate logging code, we need to make sure we use
logger.at<Level>().addKeyValue("key", "value").log()
pattern with static message and properties passed withaddKeyValue
method.