Saurabh Araiyer
Saurabh Araiyer

Reputation: 140

Is there a way to logformat Dropwizard access.log

I have used the following in my configuration file, still I am getting standard server logs in access.log, is there a way to modify it? Dropwizard version 0.7

server:
  adminConnectors:
    -
      port: 8889
      type: http
  applicationConnectors:
    -
      acceptorThreads: 7
      port: 8888
      selectorThreads: 14
      type: http
  maxQueuedRequests: 1024
  maxThreads: 1024
  requestLog:
    appenders:
      -
        archive: true
        archivedFileCount: 3
        archivedLogFilenamePattern: /var/log/access-%i.log
        currentLogFilename: /var/log/access.log
        logFormat: '[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level]'
        maxFileSize: 200MB
        threshold: ALL
        timeZone: IST
        type: file-size-rolled
    timeZone: IST

Upvotes: 1

Views: 1913

Answers (1)

polesen
polesen

Reputation: 713

You need to put the section under "server" (like you have), like this:

server:
  requestLog:
    appenders:
      - type: console
        threshold: ALL
        logFormat: '%h [%date{ISO8601}] "%r" %s %b %D [%i{User-Agent}]'

and you need to use a "newer" version (I think from 0.9.something) to get the logFormat stuff working.

I think it is because they changed from Jetty access log implementation to using logback access (http://logback.qos.ch/access.html) in newer versions.

Upvotes: 2

Related Questions