It would be very useful for me to see in the terminal what requests are executed and how long they take.
Logging of HTTP requests works fine, but I did not find a similar function for SQL.
Is there a way to enable logging globally using config.yaml
or in prepare()
of ApplicationChannel?
Asked
Active
Viewed 260 times
2

Zakhar Skorokhodov
- 197
- 10
1 Answers
3
Looks like i found dirty hack solution:
Future prepare() async {
logger.onRecord.listen((rec) => print("$rec ${rec.error ?? ""} ${rec.stackTrace ?? ""}"));
logger.parent.level = Level.FINE;
...
}
We need to set log level higher then default INFO
. All SQL queries log their requests on FINE
level.
I expected that this setting should be able to load from a config.yaml
, but I did not find anything similar.
More about log levels can be find here

Zakhar Skorokhodov
- 197
- 10
-
Yes, it’s currently not very configurable - if the logger level is fine or below, you’ll see your queries. See also this issue if you have ideas on how you’d like to control logging: https://github.com/stablekernel/aqueduct/issues/447 – Joe Conway Jan 13 '19 at 16:11