Unable to get the AWSRequestId from LambdaLogger
glambert22 opened this issue · 1 comments
glambert22 commented
Hi, I took me some time to get pass the No SLF4J issue. with the current config in my build.gradle
// runtime dependencies
implementation 'org.slf4j:slf4j-api:1.8.0-beta4'
implementation ('ch.qos.logback:logback-classic:1.3.0-alpha4') {
exclude group: 'ch.qos.logback', module: 'logback-core'
}
compile 'ch.qos.logback:logback-core:1.3.0-alpha4'
runtimeOnly 'org.jlib:jlib-awslambda-logback:1.0.0
once I got passed that I have the following in my logback.xml:
<appender name="awslambda" class="org.jlib.cloud.aws.lambda.logback.AwsLambdaAppender">
<encoder type="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{ISO8601} <%-36X{AWSRequestId}> [%t] %-5p %c:%L - %m%n</pattern>
</encoder>
</appender>
I've enabled scan and debug on the configuration. Here is the output:
22:40:36,101 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - No 'scanPeriod' specified. Defaulting to 1 minutes
22:40:36,228 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/var/task/logback.xml]
22:40:36,228 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 1 minutes
22:40:36,281 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
22:40:36,334 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [analytics-appender]
22:40:36,963 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [net.logstash.logback.fieldnames.LogstashFieldNames] for [fieldNames] property
22:40:39,376 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [org.jlib.cloud.aws.lambda.logback.AwsLambdaAppender]
22:40:39,389 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [awslambda]
22:40:39,391 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
22:40:39,784 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [analytics] to DEBUG
22:40:39,784 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [analytics] to false
22:40:39,785 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [analytics-appender] to Logger[analytics]
22:40:39,799 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [lambda.export] to DEBUG
22:40:39,800 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
22:40:39,800 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [awslambda] to Logger[ROOT]
22:40:39,800 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
22:40:39,809 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@25bbf683 - Registering current configuration as safe fallback point
2021-07-13 22:40:42,621 <> INFO org.springframework.context.annotation.AnnotationConfigApplicationContext:581 - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3c0a50da: startup date [Tue Jul 13 22:40:42 GMT 2021]; root of context hierarchy
2021-07-13 22:40:45,761 <> INFO org.springframework.beans.factory.support.DefaultListableBeanFactory:818 - Overriding bean definition for bean 'dynamoDBClient' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=DBCommonConfig; factoryMethodName=dynamoDBClient; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [DBCommonConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=exportConfig; factoryMethodName=dynamoDBClient; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ExportConfig.class]]
2021-07-13 22:40:45,764 <> INFO org.springframework.beans.factory.support.DefaultListableBeanFactory:818 - Overriding bean definition for bean 'mapper' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=DBCommonConfig; factoryMethodName=mapper; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [DBCommonConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=true; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=commonUtilConfig; factoryMethodName=mapper; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [CommonUtilConfig.class]]
2021-07-13 22:40:45,765 <> INFO org.springframework.beans.factory.support.DefaultListableBeanFactory:818 - Overriding bean definition for bean 'sqsClient' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=exportConfig; factoryMethodName=sqsClient; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [ExportConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=commonUtilConfig; factoryMethodName=sqsClient; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [CommonUtilConfig.class]]
2021-07-13 22:41:02,453 < > [main] DEBUG t:32 - ResponseReport handler started
2021-07-13 22:41:04,682 < > [main] INFO t:52 - Started Report Lambda with request: {year=2021, month=05}
2021-07-13 22:41:04,751 < > [main] INFO
Note the last three lines. That is the place holder for the AWSRequestId
igorakkerman commented
Hi @glambert22, sorry for the late reply. Since you closed the issue, were you able to resolve it?