DropWizard 0.7.1.

using DW 0.7.1 I am successfully viewing the http request logs with the following configuration:

server: requestLog: appenders: - type: file currentLogFilename: /var/test/http-test.log archivedLogFilenamePattern: /var/test/http-test-%d.log archivedFileCount: 5 timeZone: UTC

however, with a yml entry for logging non-http requests configured as follows (using bare-bones definitions only)

logging: # The default level of all loggers. # Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL. level: ERROR appenders: - type: file currentLogFilename: /var/test/test.log archivedLogFilenamePattern: /var/test/test-%d.log archivedFileCount: 5 timeZone: UTC

i NEVER watch the logs in / var / test /

Instead, I see the app is just waving the default INFO file to the console.

Note: if I replace "file" with console, running the bootstrap will prompt "currentLogFilename is not a console attribute" etc, so the DI starts up.

It seems that if I use a file though ... I can't get it to go anywhere other than the console at the default INFO levels.

early.

+3


source to share


1 answer


I figured out what the problem is.

my ApiConfiguration (extension io.dropwizard.Configuration) tried to bind to the "logging" value, explicitly like this



@Valid
@NotNull
@JsonProperty("logging")
private LoggingFactory loggingFactory = new LoggingFactory();
public LoggingFactory getLoggingFactory()
{
    return loggingFactory;
}

      

pending, I just removed the binding in the ApiConfiguration and now the logs are writing to the expected / var / test / location at the expected log level.

+1


source







All Articles