Tuesday, May 03, 2016

How to set your log4j2 file to support the lambda appender.

Add to your gradle config:

compile 'com.amazonaws:aws-lambda-java-log4j:1.0.0'
and How to set your log4j2 file to support the lambda appender.


<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" packages="com.amazonaws.services.lambda.runtime.log4j">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %C - %msg%n"/>
</Console>
<LambdaAppender name="LambdaAppender">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1}:%L - %m%n"/>
</LambdaAppender>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console" />
</Root>
<Logger name="com.dronze.aws.lambda" level="debug" additivity="false">
<AppenderRef ref="LambdaAppender" />
</Logger>
</Loggers>
</Configuration>

No comments: