-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/378 request logging #379
Conversation
<logger name="io.vertx.ext.web.handler.impl.LoggerHandlerImpl" level="INFO" additivity="false"> | ||
<appender-ref ref="access"/> | ||
</logger> | ||
|
||
<logger name="io.knotx" level="INFO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add logger for io.vertx, io.reactivex ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that for WARN
level.
</encoder> | ||
</appender> | ||
|
||
<logger name="io.vertx.ext.web.handler.impl.LoggerHandlerImpl" level="INFO" additivity="false"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some comment that it logs requests :)
| Name | Type | Mandatory | Description | | ||
|-------:|:-------:|:-------: |-------| | ||
| `enabled` | `boolean` | | Enable/Disable access log. Default is `true` | | ||
| `immediate` | `boolean` | | Log before request or after. Default is `false` - log after request | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this property should be mode
with values "before"
and "after"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep it as it is now, as the same terminology is in the vertx access log handler used here.
|-------:|:-------:|:-------: |-------| | ||
| `enabled` | `boolean` | | Enable/Disable access log. Default is `true` | | ||
| `immediate` | `boolean` | | Log before request or after. Default is `false` - log after request | | ||
| `format` | `String` | | Format of the access log. Allowed valueds are `DEFAULT`, `SHORT`, `TINY`. Default tries to log in a format similar to Apache log format, while the other 2 are more suited to development mode. Default format is `DEFAULT` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide here any url to documentation defining Apache log format
?
Maybe there should be a short note with link to #configure-access-log
where those formats are explained?
|
||
public class AccessLogConfig { | ||
|
||
public static final boolean DEFAULT_ENABLED = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can make those constants at least package private if not private
.
@@ -38,6 +38,20 @@ | |||
</encoder> | |||
</appender> | |||
|
|||
<appender name="access" class="ch.qos.logback.core.FileAppender"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is also worth to update example
in the same way as standalone
(logging to file appender instead of STDOUT
)?
Or maybe in the example everything should be logged int STDOUT
?
<logger name="io.vertx.ext.web.handler.impl.LoggerHandlerImpl" level="INFO" additivity="false"> | ||
<appender-ref ref="access"/> | ||
</logger> | ||
|
||
<logger name="io.knotx" level="INFO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that for WARN
level.
Please review once again. Improved logging capabilities to be more easier to configure. Created documentation page about how to configure logging. |
private static final boolean DEFAULT_LOGGER_IMMEDIATE = false; | ||
private static final String DEFAULT_LOGGER_FORMAT = LoggerFormat.DEFAULT.toString(); | ||
|
||
private boolean enabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config properties can be final.
Description
Added access logging capabilities to the Knotx HTTP Server. The feature uses the Vert.x logging handler so it brings a limited capabilities of the log message configuration, such as:
Besides, a default logback configuration updated to add additional log appender for a access log.
Motivation and Context
The operation & maintenance of the Knot.x require the access log information to be able to monitor/trouble shoot the set up.
It partially fixes #378
Screenshots (if appropriate):
Types of changes
Checklist:
I hereby agree to the terms of the Knot.x Contributor License Agreement.