<@U092308M7> Could you take a look at my test and ...
# ktor
d
@orangy Could you take a look at my test and tell me if I did something wrong? Because the
applicationStarting
event never seems to get logged. There is also some weirdness WRT
logger.isTraceEnabled
reporting
false
even though logging succeeds.
o
I'll check it later today. Cooking for kids :)
d
Okay, thanks
o
applicationStarting event is called before module functions are executed. So when application code is run (and installs CallLogging), it is already executed. Good catch! We need to think if it’s fine or not.
Currently hosts are using it to attach their handlers and install their interceptors into an application, including when application reloads
d
I am thinking that I would like to create a separate PR for the unit tests, and then rebase the
logging-improvements
branch onto it. I want to do this because the tests are needed regardless of whether this PR is merged. Does this sound okay to you?
o
You might want to set code style to import with * for this project 🙂
Also, I don’t think you really need
CopyOnWriteArrayList
there, calls in tests are sequential unless you specifically make them parallel
Otherwise looks good!
d
Changes made, thanks.
o
Thanks! However
assertEquals("Application starting: $hash", messages[1])
is still failing.
I mean for now let’s make it without
starting
, we’ll get to it later.
d
Yeah... I wasn't sure whether to commit a failing test, I am very new to this
My thinking was, it's better to have the test fail, than to change the test in such a way that it no longer represents expected behaviour?
o
The problem is it’s unclear what behaviour is expected at this moment.
The logic behind events is clear. * application instance created * starting * all app code executed (modules) * started * app serving calls * stopping * all features removed, closables called, etc * stopped
CallLogging, being an application feature, thus cannot participate in starting & stopped events. So the question is if we should make call logging something like “environment” feature (we don’t have such a thing yet), or ensure stopped is not called on it
d
Okay, I fixed the test to match current behaviour.
o
Thanks!
d
I understand... I wish I knew enough about the internals of Ktor to contribute a meaningful opinion here.
o
Merged, thanks!
I’m thinking lifecycle events shouldn’t be logged by this feature at all. They should be logged by host.
So, do I wait for rebase of the log-level branch and tests?
d
Done; sorry, was having dinner.
Is the current state of
logging-improvements
acceptable? It throws on illegal log level, rather than logging an error
Actually, this raises an earlier issue I was having; the tests fail because
Logger.isTraceEnabled
is reporting
false
even though the logging statements are invoked properly... not sure what is going on here
o
I’ll check it tomorrow, or may be on Monday. It’s already 1:15 into Saturday night here 🙂
d
Okay, no worries.