feat(log): add stopChainOnFailure handler option #10578
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 319 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.345
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #10578"
general
weight: 0.35
neznaika0
RESULT_STOPconstants. That approach was dropped after review in favour of a config option. Review comments the force-push refer to the original implementation.Follow-up to #10560.
Logger::log()stops running handlers when one returnsfalsefromhandle().FileHandlerandErrorlogHandlerreturn
falsewhen a write fails, so one failing handler (e.g.FileHandlerwith bad permissions on the log directory) silently prevents every handler after it from logging. A configuredErrorlogHandlerfallback never runs and the logentry is lost.
This PR adds a per-handler option,
stopChainOnFailure, forFileHandlerandErrorlogHandler, set in the handlersettings of
Config\Logger:true(default, also when the key is missing): a failed write returnsfalseand stops the chain. Same as today. -false: a failed write returnstrue, so the handlers after it still run.The option is read in
BaseHandler, so custom handlers extending it can use it as well. Custom handlers can still returnfalseto stop the chain on purpose.There is no breaking change:
HandlerInterface::handle()still returnsbool, andLogger::log()is not modified.app/Config/Logger.phpfiles work unchanged.BaseHandlergains a new protected property,bool $stopChainOnFailure.Project files:
app/Config/Logger.php:stopChainOnFailureadded to theFileHandlerblock and to the commentedErrorlogHandlerblock. The@vartype of$handlersnow includesbool(same inMockLogger).Tests:
LoggerTest: aFileHandlerpointed at a missing directory followed byTestHandler. With the default, the second handler does not log. With'stopChainOnFailure' => false, it does.FileHandlerTestandErrorlogHandlerTest: default, explicittrue, andfalseon a failed write.FileHandlerTestalso covers a successful write withfalse.User guide:
general/logging.rst: new section "Stopping the Handler Chain on Failure" with an example.v4.8.0.rst: entry under Enhancements.upgrade_480.rst:app/Config/Logger.phplisted under the config content changes.Checklist: