Skip to content

Commit

Permalink
Added environment variables to configure log levels - closes #16
Browse files Browse the repository at this point in the history
  • Loading branch information
devatherock committed Nov 14, 2020
1 parent 669356c commit f9e5118
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Initial version that generates docker pulls, image size and layers badges
- `/health` endpoint
- Custom badge generator
- [Issue 16](https://github.com/devatherock/artifactory-badge/issues/16): Environment variables to configure log levels

### Changed
- Caught exception when JSON processing fails
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# artifactory-badge
Badge generator for docker registries hosted in jfrog artifactory

## Enabling debug logs for troubleshooting
- Set the environment variable `LOGGING_LEVEL_ROOT` to `DEBUG` to enable all debug logs - custom and framework
- Set the environment variable `LOGGING_LEVEL_IO_GITHUB_DEVATHEROCK` to `DEBUG` to enable debug logs only in custom code
- For fine-grained logging control, supply a custom [logback.xml](http://logback.qos.ch/manual/configuration.html) file
and set the environment variable `JAVA_OPTS` to `-Dlogback.configurationFile=/path/to/custom/logback.xml`

## Sample badge generated by the custom generator
```xml
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="144" height="20" role="img" aria-label="docker pulls: 47">
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<configuration>
<variable name="LOGGING_LEVEL_ROOT" value="${LOGGING_LEVEL_ROOT:-INFO}" />
<variable name="LOGGING_LEVEL_IO_GITHUB_DEVATHEROCK" value="${LOGGING_LEVEL_IO_GITHUB_DEVATHEROCK:-INFO}" />

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
Expand All @@ -9,10 +11,10 @@
</encoder>
</appender>

<root level="info">
<root level="${LOGGING_LEVEL_ROOT}">
<appender-ref ref="STDOUT" />
</root>
<!--<logger name="io.github.devatherock" level="DEBUG" />-->
<logger name="io.github.devatherock" level="${LOGGING_LEVEL_IO_GITHUB_DEVATHEROCK}" />
<!--<logger name="io.micronaut.http.client" level="DEBUG" /> -->
<!--<logger name="io.micronaut.context.condition" level="TRACE" />-->
</configuration>

0 comments on commit f9e5118

Please sign in to comment.