我使用dropwizard 0.9.2并且必须upgrade jackson to 2.7.3才能至少开始执行以下配置:
server:
applicationConnectors:
- type: http
port: 8080
adminConnectors:
- type: http
port: 8081
requestLog:
timeZone: UTC
appenders:
- type: console
logFormat: "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
- type: file
currentLogFilename: ./logs/vrp-app.log
archivedLogFilenamePattern: ./logs/vrp-app.%d.log.gz
logFormat: "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
logging:
level: INFO
loggers:
"org.hibernate":
level: DEBUG
appenders:
- type: console
timeZone: UTC
logFormat: "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
- type: file
timeZone: UTC
currentLogFilename: ./logs/vrp-app.log
archivedLogFilenamePattern: ./logs/vrp-app.%d.log.gz
archivedFileCount: 5
logFormat: "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
但请求日志的日志格式仍然不同于其他格式:
15:46:42.717 [main] INFO org.eclipse.jetty.server.Server - Started @3751ms
127.0.0.1 - - [14/Jun/2016:13:46:48 +0000] "GET /users HTTP/1.1" 415 56 "-" "curl/7.35.0" 136
保持" -type"希望从logging
部分选择配置的行也不起作用。
我做错了什么?
这应该符合this discussion
可以为请求日志和正常日志指定相同的日志'为什么这会分开呢?
答案 0 :(得分:1)
格式与http://logback.qos.ch/access.html
中指定的格式略有不同更多参考:https://www.loggly.com/ultimate-guide/apache-logging-basics/