Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 19c00ab

Browse files
committed
Merge branch 'develop' into 'main'
Update the site: how to allow to specify a provider in AWS Lambda See merge request bot-by/slf4j-aws-lambda!21
2 parents f3fd119 + 7b5b868 commit 19c00ab

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ https://slf4j-aws-lambda.bot-by.uk/
170170
Other AWS centric loggers are [SLF4J/Logback Appender][awslambda-logback], [slf4j-simple-lambda][],
171171
Logback's [CloudWatch appender][cloudwatch-appender] and [CloudWatchLogs Java appender][cloudwatchlogs-java-appender].
172172

173+
See also how to [setup a provider by a system property][setup-provider]
174+
173175
## Contributing
174176

175177
Please read [Contributing](contributing.md).
@@ -227,3 +229,5 @@ limitations under the License.
227229
[cloudwatch-appender]: https://github.com/sndyuk/logback-more-appenders
228230

229231
[cloudwatchlogs-java-appender]: https://github.com/boxfuse/cloudwatchlogs-java-appender
232+
233+
[setup-provider]: https://slf4j-aws-lambda.bot-by.uk/setup-provider.html

src/site/markdown/configuration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ logLevelSeparator=\\s+
5757
markerSeparator=\\|
5858
```
5959

60+
See also how to [setup a provider by a system property][setup-provider]
6061

6162
[manual]: https://www.slf4j.org/manual.html
6263

6364
[slf4j-simple]: https://www.slf4j.org/api/org/slf4j/simple/SimpleLogger.html
6465

6566
[SimpleDateFormat]: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/SimpleDateFormat.html
67+
68+
[setup-provider]: setup-provider.html

src/site/markdown/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ than **logback** (888K).
2323
* [Acquire][]
2424
* [Usage][]
2525
* [Configuration][]
26+
* [Setup a provider by a system property][setup-provider]
2627

2728
[SLF4J]: https://www.slf4j.org/
2829

@@ -41,3 +42,5 @@ than **logback** (888K).
4142
[Usage]: usage.html
4243

4344
[Configuration]: configuration.html
45+
46+
[setup-provider]: setup-provider.html
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Setup a provider by a system property
2+
3+
[SLF4J 2.0.9][slf4j.provider] allows a provider to be explicitly specified.
4+
Since AWS Lambda Environment does not provide any configuration options to set what options
5+
should be used on startup, the [trick is to use the JAVA_TOOL_OPTIONS][java-tool-options-trick]
6+
environment variable.
7+
8+
If your AWS Java Lambda has some SLF4J providers and you want to point one of them,
9+
that needs to setup a System property named `slf4j.provider`, as in the following:
10+
11+
![Using JAVA_TOOL_OPTIONS to setup a provider](environment-variable-screenshot.png)
12+
13+
Further reading [AWS Lambda, Developer Guide: Configuring environment variables][configuration-envvars]
14+
15+
[slf4j.provider]: https://jira.qos.ch/browse/SLF4J-450 "[SLF4J-450]: Allow binding to be explicitly specified"
16+
17+
[java-tool-options-trick]: https://zenidas.wordpress.com/recipes/system-properties-for-a-java-lambda-function/ "System properties for a Java Lambda function"
18+
19+
[configuration-envvars]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html "Using Lambda environment variables"
23.4 KB
Loading

0 commit comments

Comments
 (0)