The AWS java lambda documentation makes reference to a logger obtained by context.getLogger
.
What are the benefits of using this logger versus instantiating some other logger from a standard framework (e.g. slf4j)?
Thank you in advance for your consideration and response.
CodePudding user response:
The primary advantage is that it is included in the Lambda runtime, without needing to be included in your deployment package. Which keeps your deployment file smaller, which helps a bit with the timing of cold starts.
It's also one less thing you have to manage yourself. For example if you were including Log4J in your deployment, it would be up to you to update the version of Log4J to fix all the security issues with that library. Whereas if you are using the included library Amazon would fix any security issues with that for you without you even needing to think about it.