dropwizard-logging-config

Runtime Configuration for Dropwizard Logging

License

License

Categories

Categories

DropWizard Container Microservices config Application Layer Libs Configuration Logging
GroupId

GroupId

org.stuartgunter
ArtifactId

ArtifactId

dropwizard-logging-config
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

dropwizard-logging-config
Runtime Configuration for Dropwizard Logging
Project URL

Project URL

http://www.stuartgunter.org/open-source.html
Project Organization

Project Organization

Stuart Gunter
Source Code Management

Source Code Management

https://github.com/stuartgunter/dropwizard-logging-config

Download dropwizard-logging-config

How to add to project

<!-- https://jarcasting.com/artifacts/org.stuartgunter/dropwizard-logging-config/ -->
<dependency>
    <groupId>org.stuartgunter</groupId>
    <artifactId>dropwizard-logging-config</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.stuartgunter/dropwizard-logging-config/
implementation 'org.stuartgunter:dropwizard-logging-config:0.1'
// https://jarcasting.com/artifacts/org.stuartgunter/dropwizard-logging-config/
implementation ("org.stuartgunter:dropwizard-logging-config:0.1")
'org.stuartgunter:dropwizard-logging-config:jar:0.1'
<dependency org="org.stuartgunter" name="dropwizard-logging-config" rev="0.1">
  <artifact name="dropwizard-logging-config" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.stuartgunter', module='dropwizard-logging-config', version='0.1')
)
libraryDependencies += "org.stuartgunter" % "dropwizard-logging-config" % "0.1"
[org.stuartgunter/dropwizard-logging-config "0.1"]

Dependencies

provided (1)

Group / Artifact Type Version
io.dropwizard : dropwizard-core jar 0.7.1

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.assertj : assertj-core jar 1.6.1

Project Modules

There are no modules declared in this project.

dropwizard-logging-config

Build Status

Note: This task is included in the Dropwizard core since v0.8.0 and is enabled by default for the admin environment.

The dropwizard-logging-config library allows you to configure Logback within a Dropwizard app at runtime. It provides a Dropwizard Task that can be made accessible via the admin interface to allow for runtime changes to the logging level of any logger in the application. This is intended to provide similar functionality to Logback's JmxConfigurator, but using a standard Dropwizard approach.

Usage

To use this task, simply register it in your Dropwizard application. The dependency can be found in Maven Central with the following coordinates:

<dependency>
  <groupId>org.stuartgunter</groupId>
  <artifactId>dropwizard-logging-config</artifactId>
  <version>${dropwizard-logging-config.version}</version>
</dependency>

Once you have the dependency registered, register the LogConfigurationTask in your application as follows:

public class YourApp extends Application<YourConfig> {

    @Override
    public void run(YourConfig configuration, Environment environment) throws Exception {
        environment.admin().addTask(new LogConfigurationTask());
    }
}

That's all you need to do in code. All that remains is to call the tasks endpoint correctly. Below are some examples of how you can do that.

Configure a user-defined log level for a single Logger

curl -X POST -d "logger=org.stuartgunter.dropwizard&level=INFO" http://localhost:8081/tasks/log-level

Configure a user-defined log level for multiple Loggers

curl -X POST -d "logger=org.stuartgunter.dropwizard&logger=io.dropwizard.core&level=INFO" http://localhost:8081/tasks/log-level

Configure the default log level for a single Logger

curl -X POST -d "logger=org.stuartgunter.dropwizard" http://localhost:8081/tasks/log-level

Versions

Version
0.1