AWS lambda currently supports two ways for logging, when Lambda function written in Java.
I want to know if is their any advantage of using one logging scheme over other.
Thanks!
AWS Lambda Function Logging in Python. Your Lambda function comes with a CloudWatch Logs log group, with a log stream for each instance of your function. The runtime sends details about each invocation to the log stream, and relays logs and other output from your function's code.
It also helps you log and monitor your Lambda functions for performance optimization and diagnosing application-level issues. Lambda automatically streams standard output and standard error messages from a Lambda function to CloudWatch Logs, without requiring logging drivers.
Another best practice is to set the log output level by using a variable and adjust it based on the environment and your requirements. Your Lambda function's code, in addition to the libraries used, could output a large amount of log data depending on the log output level. This can impact your logging costs and affect performance.
A separate log stream is created in the log group for each Lambda function instance. Lambda has a standard naming convention for log streams that uses a YYYY/MM/DD/ [<FunctionVersion>]<InstanceId> format. The InstanceId is generated by AWS to identify the Lambda function instance.
What I understood from Aws Lambda Java Logging and searching around net is
Log4J
LambdaLogger
I hope that it helps!
In my opinion to keep it simple.
1. Assume you have an application project in maven where there will be multiple maven modules. You won't be passing context.getLogger() OR context argument every time you call some other module's implementation.
2. If you have a single handler function with no modules and multiple classes. In this case, you can start your AWS Lambda handler function code and get the context.getLogger() to get Lambda logger.
For more info : http://docs.aws.amazon.com/lambda/latest/dg/programming-model-v2.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With