filterFactories and file logging

22 views
Skip to first unread message

Les Davis

unread,
Feb 16, 2022, 7:11:43 PM2/16/22
to dropwizard-user
Hi all, 

I'm trying to setup a filter factory with file logging configured in Dropwizard. I am following the documentation and I'm getting some weird behavior. I is not logging to the file when I configure the filterFactory only the console. I know I have the filter factory set up correctly as I have the code writing out to System.out and that message is showing up, just only in the console and not the file. This is my config from the .conf file:

logging {
  level: INFO
  loggers: {
    "com.oracle.graphqlloggingdemo": {
      appenders:  [{
        type: file
        currentLogFilename: ${logdir}/application.log
        archive: true
        archivedLogFilenamePattern: ${logdir}/applicationPort.%d"{yyyy-MM-dd_HH, UTC}".%i.log.gz
        archivedFileCount: 24
        timeZone: UTC
        maxFileSize: 100MB
        filterFactories: [{
          type: secret-filter-factory
        }]
      }]
    }
}
  appenders += {
      type: console
      timeZone: UTC
      threshold: DEBUG
      target: stdout
      logFormat: "%-5level %date{ISO8601, UTC} %dwTimeZone %mdc{opc-request-id} [%thread] %logger: %message%n"
    }
}

With this config the messages show up in the console only not the file as expected, if I remove the lines defining the "filterFactories" then it writes to the file as expected.

Thanks
-Les
Reply all
Reply to author
Forward
0 new messages