How to enable/disable log levels in drop wizzard 2.0.2

534 views
Skip to first unread message

Kuttaiah Robin

unread,
Jun 27, 2020, 1:47:26 AM6/27/20
to dropwizard-user
Hello all,

I need help in enabling/disabling log levels in dropwizzard micro service.

In the logs I see below snippet.

-----------------
INFO  [2020-06-27 05:29:10,087] org.eclipse.jetty.server.handler.ContextHandler: Started i.d.j.MutableServletContextHandler@2aea717c{/insight-server/api/1.0,null,AVAILABLE}
INFO  [2020-06-27 05:29:10,132] io.dropwizard.setup.AdminEnvironment: tasks =

    POST    /tasks/log-level (io.dropwizard.servlets.tasks.LogConfigurationTask)
    POST    /tasks/gc (io.dropwizard.servlets.tasks.GarbageCollectionTask)

INFO  [2020-06-27 05:29:11,267] io.dropwizard.jersey.DropwizardResourceConfig: The following paths were found for the configured resources:

    DELETE  / (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    GET     /checkState (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    GET     /health (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    GET     /liveness (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    GET     /logback/status (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    GET     /readiness (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    GET     /start (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    DELETE  /status (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
    GET     /status (oracle.mtms.infra.services.jersey.admin.AdminServicesResource)
-------------------

I know we need to use /tasks/log-level for changing the log levels via REST API.

Am not sure what is the default admin port to be used while invoking the REST API. I have not configured any admin port in my microservice.

Can someone help me  the right curl command to do this?
For e.g.  I want to enable foo.bar package logs with DEBUG level.

thanks,
Robin Kuttaiah

Dimas Guardado

unread,
Jun 27, 2020, 7:36:01 PM6/27/20
to dropwizard-user
Hi Robin,

Instructions for setting log levels via the LogConfigurationTask can be found in the docs here:

^ This contains example curl requests using the default admin ports

The logging section of the user guide also describes all methods of configuring logging should you need something that's a bit more durable than http config

Does that give you enough to work from?

Kuttaiah Robin

unread,
Jun 28, 2020, 2:31:42 AM6/28/20
to dropwizard-user
Hi Dimas,

Thank you very much. Let me have a look at it and will get back to you if it does not work.

regards,
Robin Kuttaiah
Reply all
Reply to author
Forward
0 new messages