11

My logging config looks like this:

logging:
  level: INFO

  loggers:
    "com.example.broker": DEBUG
    "org.apache.http.wire": DEBUG

  console:
    threshold: ERROR

  file:
    enabled: true
    currentLogFilename: /opt/broker/log/broker.log
    archivedLogFilenamePattern: /opt/broker/log/broker.%d.log.gz
    archivedFileCount: 14

This is awesome, I get all my logs in the given files with proper rotation and cleanup.

Except for the access log which still goes to stdout and thus ends up (in my case) in /var/log/upstart/broker.log which is accessible by root only. I'd like to make use of the same or a similar logging config to redirect those logs to /opt/broker/log/access.log.

Is this possible and if so, how?

mss
  • 1,804
  • 1
  • 17
  • 18

3 Answers3

25

Since the move from codahale to dropwizard.io, the location of the relevant section of the manual is now: http://www.dropwizard.io/0.9.2/docs/manual/configuration.html#request-log

Note that the request log is now set under server rather than http - making the relevant YAML configuration:

server:
  requestLog:
    timeZone: UTC
    appenders:
      - type: file
        currentLogFilename: /opt/broker/log/access.log
        threshold: ALL
        archive: true
        archivedLogFilenamePattern: /opt/broker/log/access.%d.log.gz
        archivedFileCount: 14
Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183
Robin Bramley
  • 265
  • 3
  • 5
10

Reading the documentation actually helps:

http:
    requestLog:
        console:
            enabled: false
        file:
            enabled: true
            currentLogFilename: /opt/broker/log/access.log
            archivedLogFilenamePattern: /opt/broker/log/access.%d.log.gz
            archivedFileCount: 14
Nicholas White
  • 2,702
  • 3
  • 24
  • 28
mss
  • 1,804
  • 1
  • 17
  • 18
  • You can update the answer with the correct link. I guess you'll find it under dropwizard.io – mss Aug 08 '15 at 10:52
1

Dropwizard access log config is available here.

server:
  requestLog:
    appenders:
      - type: file
        currentLogFilename: /var/log/our-app/access.log
        archivedLogFilenamePattern: /var/log/our-app/accedd-%d.log.gz
Hrishikesh Mishra
  • 3,295
  • 3
  • 27
  • 33