external logging and replacing the ObjectMapper

28 views
Skip to first unread message

Daniel Abraham

unread,
Jul 16, 2021, 10:50:50 PM7/16/21
to dropwizard-user

Hi all,

Using Dropwizard 2.0.23 (latest at time of writing this), I set up external logging per https://www.dropwizard.io/en/latest/manual/core.html#logging and all was good.  But later on I changed the default ObjectMapper with the code below.  Now sometime after that snippet runs, logging reverts to the default internal.

I threw a repo with a minimal example of the 2 versions up at https://github.com/dabraham02124/loggingTest (please see the readme for the relevant commits).

Am I doing something wrong?  Is there a better way to do this?  It seems very odd behavior to me, and I couldn't find doc explaining this.

I've found a workaround for myself (manually creating a separate ObjectMapper), but this is nagging at me.  Any ideas would be appreciated.  Thank you very much.

Daniel Abraham


    @Override
    public void initialize(final Bootstrap<LoggingTestConfiguration> bootstrap) {
        bootstrap.setObjectMapper(new ObjectMapper(new YAMLFactory()));
    }

Reply all
Reply to author
Forward
0 new messages