Pass an empty array to Dropwizard via command line

Viewed 265

I have disabled request access logging using this configuration in Dropwizard:

server:
  requestLog:
    appenders: []

I want to override it via command line, but I don't know what is correct syntax for empty array. I tried -Ddw.server.requestLog.appenders=[] or -Ddw.server.requestLog.appenders= or -Ddw.server.requestLog.appenders='' but all of them fail with:

  * Failed to parse configuration at: server.requestLog.appenders; Unexpected token (VALUE_STRING), expected FIELD_NAME: missing property 'type' that is to contain type id  (for class io.dropwizard.logging.AppenderFactory)
 at [Source: N/A; line: -1, column: -1] (through reference chain: metrics.Config["server"]->io.dropwizard.server.DefaultServerFactory["requestLog"]->io.dropwizard.request.logging.LogbackAccessRequestLogFactory["appenders"])

What is the correct way to pass an empty array?

2 Answers

The way I was successful to pass an empty array to Dropwizard was to pass the arguments like:

-Ddw.server.requestLog.appenders=,

The , is the separator for array elements so this would pass two empty strings to the array. In my case I had 3 array elements, so I had to pass ,,. I used Dropwizard 2.0.8.

Try. \[\] for empty list in command line.

Related