Logs from request/controller tests. #1179
Answered
by
kaplanelad
felipesere
asked this question in
Q&A
-
I have test failing with a 500, but I can't tell where it's really happening as I see no logs from the app. logger:
# Enable or disable logging.
enable: true
# Log level, options: trace, debug, info, warn or error.
level: trace
# Define the logging format. options: compact, pretty or Json
format: compact
# By default the logger has filtering only logs that came from your code or logs that came from `loco` framework. to see all third party libraries
# Uncomment the line below to override to see all third party libraries you can enable this config and override the logger filters.
override_filter: trace
server:
# Port on which the server will listen. the server binding is 0.0.0.0:{PORT}
port: 5150
# The UI hostname or IP address that mailers will point to.
host: http://localhost
# Out of the box middleware configuration. to disable middleware you can changed the `enable` field to `false` of comment the middleware block
middlewares:
# Allows to limit the payload size request. payload that bigger than this file will blocked the request.
limit_payload:
# Enable/Disable the middleware.
enable: true
# the limit size. can be b,kb,kib,mb,mib,gb,gib
body_limit: 5mb
# Generating a unique request ID and enhancing logging with additional information such as the start and completion of request processing, latency, status code, and other request details.
logger:
# Enable/Disable the middleware.
enable: true
# when your code is panicked, the request still returns 500 status code.
catch_panic:
# Enable/Disable the middleware.
enable: false All I see from the test failure is
I'd hope to see a few my Am I missing something? 😅 |
Beta Was this translation helpful? Give feedback.
Answered by
kaplanelad
Jan 15, 2025
Replies: 1 comment 1 reply
-
Hey, Here are two options to debug the test:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
felipesere
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
tracing
is a global dispatcher, so you can’t initialize it more than once, this is the reason why the logging is not shown by defaultHere are two options to debug the test:
logger::init
. Here's an example: