Repository navigation
Development diagnostics
WebEngine leaves a few useful traces behind during development so you can inspect what happened during a request without turning the whole application into a debugging exercise.
One of the most useful diagnostics is the X-Logic-Execution response header.
When page logic runs, WebEngine records the functions that executed and writes them into that header in order. The values use a compact path:function format, for example:
page/index:gopage/account/settings:go_beforepage/account/settings:do_save_profile
This is especially useful when shared logic, component logic, and page-specific logic are all involved in the same response. Instead of guessing which hooks actually ran, you can inspect the response headers in your browser's network tools and see the exact order.
Redirect handling can also expose development-oriented header information, which helps trace where a redirect rule came from.
If page logic or supporting code writes direct output with echo, var_dump, or similar calls, WebEngine captures that output instead of letting it corrupt the page response.
In development, that captured output can be surfaced through browser-side debugging support rather than becoming part of the page body. That makes accidental debug output easier to notice while still keeping the response shape intact.
This is useful while investigating a problem, but it should not become the normal way application pages communicate data. For normal behaviour, page logic should still bind data into the view model or set response state explicitly.
Sometimes you want a closer look at one part of a request without filling the log with everything else. WebEngine groups its own DEBUG messages by area, so you can switch on just the detail you need.
All of these switches default to false. For example, add this to your project's config.dev.ini to investigate routing and page logic:
[logger]
level=debug
debug_routing=true
debug_logic=trueThe switches decide which framework messages are generated. The destination's minimum level still decides whether those messages are written. Both need to allow the message through: setting level=debug alone does not enable these categories, and enabling a category does not override level=info or level=error.
Setting in [logger]
|
What you can see |
|---|---|
debug_html_components |
Components with and without matching PHP logic files, and missing component directories. |
debug_html_partials |
Partial expansion completion and missing partial directories. |
debug_requests |
Request lifecycle start and completion, redirect rule matches and exception handling. Completion includes the response status and elapsed time. |
debug_routing |
Path normalisation, redirects prepared during normalisation, the selected router and view, matched view and logic files, and requests with no distinct page match. |
debug_logic |
Logic file loading, function and method invocation, completed calls, component or page lifecycle starts, and response interruptions. |
debug_views |
View streaming start and completion. |
debug_csrf |
Successful CSRF verification and checks skipped for response type, request method or ignored paths. Token values are not logged. |
debug_services |
Service loader registration, missing loader classes and fallback to the default loader. |
A component does not need a PHP file. If its HTML does everything you need, there is no need to create an empty logic file to keep the logger happy.
The message Component detected without matching logic file is only generated when you opt in:
[logger]
level=debug
debug_html_components=trueThis can be handy when you expected component logic to run and want to check whether WebEngine found the file. Leave it off for everyday development if you mostly use HTML-only components.
These switches only control WebEngine's categorised DEBUG messages. Your own Log::debug() calls continue to follow the configured minimum level, and existing INFO, NOTICE, WARNING and ERROR messages keep their usual settings. The browser's buffered output is controlled separately by logger.debug_to_javascript.
You can also keep the extra detail local whilst sending errors to Sentry:
[logger]
type=sentry,stdout
level=error,debug
debug_routing=trueWith Sentry configured, this sends errors and above there, whilst the local output also includes routing diagnostics. Sentry Logs omit context fields, so details such as matched file lists are available in the local output. See Errors and logging#Sending logs to Sentry or GlitchTip for destination setup.
When you have found the problem, set the relevant switches back to false or remove your overrides.
When a request does not behave as expected, a good first pass is:
- inspect the response status
- inspect response headers such as
X-Logic-Execution - check whether a redirect happened
- look for captured debug output
- then move on to application logs if needed
That usually gives enough signal to tell whether the problem is in routing, page logic, redirect rules, or lower-level application code.
Continue with the request-response lifecycle, or read about Errors and logging.
- File-based routing
- Page views
- Page logic
- Dynamic URIs
- Headers and footers
- Custom HTML components
- Page partials
- Binding data to the DOM
- DOM manipulation
- Hello You tutorial
- Todo list tutorial
- Address book tutorial WIP
- Blueprints
- Application architecture
- Coding styleguide WIP
- PHP environment setup WIP
- Web servers WIP
- Background cron tasks
- Database setup WIP
- Client-side compilation WIP
- Testing WebEngine applications WIP
- Production checklist WIP
- Security WIP