diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a64e793..de5dd6f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ executors: auth: username: $DOCKER_USERNAME password: $DOCKER_PASSWORD - <<: *resource_class + resource_class: medium <<: *work_directory environment: # To generate swagger UI diff --git a/CHANGELOG.md b/CHANGELOG.md index c44d40f8..e4cf3d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,12 @@ # Changelog ## [Unreleased] +### Added +- [#107](https://github.com/devatherock/artifactory-badge/issues/107): `janino` to have conditions in logging config +- `dependencycheck` gradle plugin to detect vulnerable dependencies + ### Changed -- chore(deps): update plugin io.micronaut.application to v2.0.5 - chore: Added changelog-updater for creating missed changelog entries -- chore(deps): update plugin com.diffplug.spotless to v5.15.1 -- chore(deps): update plugin io.micronaut.application to v2.0.6 -- chore(deps): update plugin com.diffplug.spotless to v5.15.2 - chore(deps): update dependency org.projectlombok:lombok to v1.18.22 - chore(deps): update plugin com.diffplug.spotless to v5.17.0 - chore(deps): update plugin io.micronaut.application to v2.0.7 diff --git a/README.md b/README.md index 613b067e..8e7a52dc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,16 @@ docker run --rm \ devatherock/artifactory-badge:latest ``` -### Environment variables for configuration +### Configurable properties +#### application.yml + +```yaml +logger: + levels: + io.micronaut.http.server.netty.NettyHttpServer: TRACE # Optional. To enable HTTP server access logs +``` + +#### Environment variables | Name | Required | Default | Description | |---------------------------------------|--------------|------------------|-----------------------------------------------------------------------------------| @@ -31,6 +40,7 @@ docker run --rm \ | LOGGER_LEVELS_IO_GITHUB_DEVATHEROCK | false | INFO | [SLF4J](http://www.slf4j.org/api/org/apache/commons/logging/Log.html) log level, for custom code | | MICRONAUT_ENVIRONMENTS | false | (None) | Setting the value to `local` will mock the calls to the artifactory. Only for testing purposes | | MICRONAUT_SERVER_PORT | false | 8080 | Port in which the app listens on | +| MICRONAUT_CONFIG_FILES | true | (None) | Path to YAML config files. The YAML files can be used to specify complex, object and array properties | | JAVA_OPTS | false | (None) | Additional JVM arguments to be passed to the container's java process | ### Endpoints @@ -70,7 +80,8 @@ docker run --rm \ and set the environment variable `JAVA_OPTS` to `-Dlogback.configurationFile=/path/to/custom/logback.xml` ### JSON logs +Refer [logstash-logback-encoder](https://github.com/logstash/logstash-logback-encoder) documentation to customize the field names and formats in the log -To output logs as JSON, set the environment variable `JAVA_OPTS` to `-Dlogback.configurationFile=logback-json.xml`. Refer -[logstash-logback-encoder](https://github.com/logstash/logstash-logback-encoder) documentation to customize the field names and -formats in the log +- With the default logging config, if `MICRONAUT_ENVIRONMENTS` environment variable has the value `local`, logs will be in plain text(not JSON) format. Else they will be in JSON format +- To output logs as JSON all the time, set the environment variable `JAVA_OPTS` to `-Dlogback.configurationFile=logback-json.xml` +- To output logs as plain text(not JSON) all the time, set the environment variable `JAVA_OPTS` to `-Dlogback.configurationFile=logback-plain.xml` diff --git a/build.gradle b/build.gradle index 0e4d41b8..35d4a5a4 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,7 @@ plugins { id 'org.sonarqube' version '3.3' id 'com.github.kt3k.coveralls' version '2.12.0' id 'com.diffplug.spotless' version '5.17.0' + id 'org.owasp.dependencycheck' version '6.4.1.1' } version "0.4.0" @@ -48,8 +49,11 @@ dependencies { implementation "io.micronaut.cache:micronaut-cache-caffeine" implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '6.6' + implementation group: 'org.codehaus.janino', name: 'janino', version: '3.1.6' + implementation group: 'io.netty', name: 'netty-all', version: '4.1.69.Final' runtimeOnly "ch.qos.logback:logback-classic:1.2.6" + testAnnotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion") testAnnotationProcessor "io.micronaut:micronaut-inject-java" testImplementation "io.micronaut:micronaut-inject-groovy" diff --git a/src/main/resources/logback-json.xml b/src/main/resources/logback-json.xml index acad78a3..c674d912 100644 --- a/src/main/resources/logback-json.xml +++ b/src/main/resources/logback-json.xml @@ -6,5 +6,4 @@ - diff --git a/src/main/resources/logback-plain.xml b/src/main/resources/logback-plain.xml new file mode 100644 index 00000000..ca6d268a --- /dev/null +++ b/src/main/resources/logback-plain.xml @@ -0,0 +1,14 @@ + + + true + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 1c589d83..f1a27e2d 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -7,11 +7,19 @@ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + - + + + + + + + + - - -