You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Request Logging**
As part of the HTTP 2.x upgrade I wanted to ensure we didn't drop support for request logs. I've carried over the exact same spec + small improvements so previous log formats should work as is. Any web framework needs to have some level of default logging in place, so I had to postpone the upgrade until something like this was in place
- `access_log` is still the main entry point for customizing the log format
- The `logfmt` macro from 1.x of HTTP.jl is carried over
- The same log formatting is used and exposed as`oxygen_logfmt` (used by default)
**Docs Prefix Bug**
Fixed an issue where docs wouldn't render properly due to the absolute paths that were configured internally. When running oxygen behind a reverse-proxy, the docs pages weren't accessible. The solution was to make sure all docs links are relative links so they work with custom and global prefixes
Copy file name to clipboardExpand all lines: README.md
+28-4Lines changed: 28 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1055,10 +1055,34 @@ serve()
1055
1055
```
1056
1056
## Logging
1057
1057
1058
-
HTTP.jl 2.x no longer does per-request access logging in the server, so the `access_log` keyword
1059
-
(and the `logfmt"..."` format macro) from earlier Oxygen versions is gone. The `access_log` kwarg
1060
-
is still accepted by `serve()` and `serveparallel()` for backwards compatibility, but it is ignored.
1061
-
If you need request logging, add it yourself with a small [middleware](#middleware) function.
1058
+
Since HTTP.jl 2.x no longer performs per-request access logging in the server,
1059
+
we reintroduced request-level logging through the built-in `AccessLog` middleware. It emits a log entry
1060
+
for each request through Julia's logging system (at `Info` level with `_group=:access`) using
1061
+
NGINX-style format strings defined with the `logfmt"..."` macro.
1062
+
1063
+
In practice, you'll rarely need to configure this middleware function yourself. The main entrypoint to configure the logging format is the `access_log` keyword in the `serve()` and `serverparallel()` function:
Copy file name to clipboardExpand all lines: docs/src/index.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1055,10 +1055,34 @@ serve()
1055
1055
```
1056
1056
## Logging
1057
1057
1058
-
HTTP.jl 2.x no longer does per-request access logging in the server, so the `access_log` keyword
1059
-
(and the `logfmt"..."` format macro) from earlier Oxygen versions is gone. The `access_log` kwarg
1060
-
is still accepted by `serve()` and `serveparallel()` for backwards compatibility, but it is ignored.
1061
-
If you need request logging, add it yourself with a small [middleware](#middleware) function.
1058
+
Since HTTP.jl 2.x no longer performs per-request access logging in the server,
1059
+
we reintroduced request-level logging through the built-in `AccessLog` middleware. It emits a log entry
1060
+
for each request through Julia's logging system (at `Info` level with `_group=:access`) using
1061
+
NGINX-style format strings defined with the `logfmt"..."` macro.
1062
+
1063
+
In practice, you'll rarely need to configure this middleware function yourself. The main entrypoint to configure the logging format is the `access_log` keyword in the `serve()` and `serverparallel()` function:
access_log isa Function ||throw(ArgumentError("access_log must be a formatter function `(io::IO, req::HTTP.Request) -> nothing`, e.g. a logfmt\"...\" value"))
356
+
[AccessLog(format=access_log)]
357
+
else
358
+
[]
359
+
end
360
+
347
361
# combine all our middleware functions
348
362
returnreduce(|>, [
349
363
ctx.service.router,
350
364
serializer...,
351
365
custom_middleware...,
352
366
collect_metrics...,
353
367
docs_middleware...,
368
+
access_loggers...,
354
369
global_prefix_middleware...
355
370
])
356
371
end
@@ -395,12 +410,11 @@ end
395
410
396
411
397
412
"""
398
-
Removes deprecated keys from incoming keyword arguments, currently: :stream, :access_log, and :queuesize.
413
+
Removes deprecated keys from incoming keyword arguments, currently: :stream and :queuesize.
0 commit comments