feat(log): allow to pass in custom loggers#69
feat(log): allow to pass in custom loggers#69line-o wants to merge 8 commits intoeeditiones:mainfrom
Conversation
f82f8c7 to
013c5a9
Compare
|
@duncdrum Do you have an idea how to test this properly? |
|
Not sure i understand your question, create a test log entry, and make sure that it only appears in the |
|
@duncdrum That's what I was looking for :) How does one access the logs of the docker container within GitHub-actions? |
|
|
|
What is the default log-level within exist-db stock images? |
|
WARN i think, its in the config file in the core repo |
|
It's safe to assume |
|
https://github.com/eXist-db/exist/blob/develop/exist-docker/src/main/xslt/log4j2-docker.xslt any of these will do, just copy the log4j file into the image |
|
I think for now it would make sense to just test that certain messages are logged to exist.log and others are not. |
We can but testing the presence of certain messages in |
|
Yes, testing that log output is written to |
|
Aha, in the docker log configuration all messages with level INFO are directed to stdout |
|
From my manual testing I could see that the message format is predictably different, though. |
|
show me the message format preferably in code, and i ll tell you |
|
I'll give you an example: When passing $logger("info", "[f6ad7ba0-8722-431f-ad7b-a08722e31f59] request get /jwt/public/1/2/this/is/just/a/test")This yields following output to stdout Each line will always start with |
|
Looks like good testcase. Although users might actually more care about actual log files on disc. As long as there are some tests I m happy. Whichever you are more comfortable with. |
|
The whole logging facility has 0 coverage at the moment. Testing docker stdout will bring us a big leap forward. |
ceff975 to
dd4e18b
Compare
This allows to use the standard or custom logger in routes and middlewares.
dd4e18b to
f80d0db
Compare
cbb7050 to
99081f1
Compare
Add new function signature roaster:route#4 allowing to pass in a custom log function.
This allows for control what is logged where and how.
Log to stdout and stderr
Log using
util:log-appFor the above to work the logger needs to be added to log4j2.xml
update
The request map now has a logger property that is a reference to the function that roaster uses to log its messages.
This allows any route handler to also log to that output.
That does also apply to middlewares