In following the getting started guide, I typically start the server via (dev)
and (go)
in the REPL. I would like to get some logging in place so that I could inspect API requests that are hitting the router. Does anyone have a recommendation for the best way to do that?
@rahx1t you mean beyond the logging of requests?
Currently I'm not sure I get any logging of requests. Should I be seeing that?
You should, but in the REPL they’re hidden in the logs
directory, I believe.
In production, the logs output to STDOUT, but that would be annoying if it did that at the REPL.
You can access the logger by including a reference to the :duct/logger
key. For example, the default request logging is handled by middleware that is configured like:
:duct.middleware.web/log-requests {:logger #ig/ref :duct/logger}
Ah that's great, thanks for that bit of info. I will give that a go when I get home tonight
Check out: https://github.com/duct-framework/logger
I also added a few recent convenience macros that aren’t mentioned in the README, so instead of writing (duct.logger/log logger :info ::key)
you can write (duct.logger/info logger ::key)
.
I’ve just run into an issue with duct/exec-config
where it appears that dependent #ig/refset
keys aren’t started. I’m not yet sure if it’s relevant but the refset keys and the parent key are split across two different profiles. It feels like this should work, is it a known issue or have I perhaps wired something up wrong?
the refset keys are all themselves composite keys, deriving from a base key. If I pass that base key in the set of keys that are started it works; but that feels like I’m having to restate my dependencies.
this setup seems to work with my repl setup… I only notice it when in production envs when I use duct/exec-config
@rickmoynihan Are you starting with a subset of keys?
Refs must be resolved, otherwise there is an error, so any keys that are ref’d by others are automatically included.
However, Refsets can be empty, so they’re effectively a weak reference.
This is deliberate, as it allows logic like saying “Start X before any key deriving from Y” without automatically including all keys from Y.