Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.abcelo:abcelo-util-aws-lambda:'
}
dependencies {
implementation("com.github.abcelo:abcelo-util-aws-lambda:")
}
<dependency>
<groupId>com.github.abcelo</groupId>
<artifactId>abcelo-util-aws-lambda</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.abcelo" % "abcelo-util-aws-lambda" % ""
:dependencies [[com.github.abcelo/abcelo-util-aws-lambda ""]]
For those building AWS Lambda Functions with libraries that log
using SLF4J, or who want to use SLF4J and conventional logging in their own
code, we offer abcelo-util-aws-lamba
's LambdaAppender
class. Please see
the example usage and logback.xml
file below.
import com.amazonaws.services.lambda.runtime.Context
import org.slf4j.LoggerFactory
class TestLambdaHandler {
import TestLambdaHandler._
def doStuff(context: Context): Unit = {
LambdaAppender.setContext(context)
log.info("Hi!")
}
}
object TestLambdaHandler {
val log = LoggerFactory.getLogger(getClass)
}
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="lambda" class="LambdaAppender">
<encoder>
<pattern>%n>>>>> %d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}: %-5p [%t] %C.%M [%F:%L]%n%m%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
</appender>
<root level="info">
<appender-ref ref="lambda"/>
</root>
</configuration>
This project is licensed under the terms of the Apache License 2.0.