hal9000
hal9000

Reputation: 221

Unable to change log level in dropwizard during runtime

my config.yml file looks something like this(logging section):

logging:
 level: INFO
 loggers:
  com.company.package: ERROR
  appenders:
    - type: console
     threshold: DEBUG

This sets all logging on the com.company.package to ERROR. I want to override this at runtime for dev environment, to log debug level logs too.

I tried doing this using:

curl -k -X POST -d "logger=com.company.package&level=DEBUG" http://localhost:8081/tasks/log-level

This doesn't help. It still only logs out ERROR level logs to console.

Also tried the answer here:

Dropwizard Admin: Change loglevel for all

This doesn't help either.

I am able to get debug logs when I change com.company.package to DEBUG, but I do not want to do it that way.

Upvotes: 2

Views: 1569

Answers (1)

Siraj K
Siraj K

Reputation: 178

I had the same issue and as you mentioned the linked issue did not solve it either

In dw 1.3.8, I found that TaskServlet line 180 requires input as query params and not in POST body

E.g.

curl -k -X POST -d "" 'https://localhost:[AdminPort]/tasks/log-level?logger=com.payit.kafka.HelloWorld&level=DEBUG'

Upvotes: 1

Related Questions