Appearance
SY-32: Logging Architecture and Migration Guide
Flow ID: SY-32 | Module(s): application/helpers, application/config/container, application/core, ecommercen/core, src/Logger, system/core, public/index.php | Complexity: Medium Last Updated: 2026-11-04 — 4.129.0 resync: #973 deprecation report (
APP_LOG_DEPRECATIONS), #977 PHP 8.4 closure frame names in the stack-trace parser, citations re-anchored; previous: 2026-10-19
Status: Active Owner: Platform team
Overview
The platform's logging is built on Monolog 3 and registered as a single Psr\Log\LoggerInterface service in DI. Modern src/ services inject the logger via constructor; legacy CI3 controllers / models / libraries access it via di()->get(LoggerInterface::class). CodeIgniter 3's global log_message() helper continues to exist and continues to work — its body has been replaced with a PSR-3 routing call so all existing call sites benefit from the same logger without source-level changes.
Boot flow
public/index.php
1. composer autoload
2. dotenv
3. require application/helpers/log_helper.php ← defines our 4 functions
4. require system/core/CodeIgniter.php
├─ set_error_handler('_error_handler') ← OUR fn (CI3 thinks it's its own)
├─ set_exception_handler('_exception_handler') ← OUR fn
├─ register_shutdown_function('_shutdown_handler') ← OUR fn
└─ Common.php loads — function_exists() guards skip CI3 defaults
5. CI3 dispatches the controller → application code runsThe four functions we override (log_message, _error_handler, _exception_handler, _shutdown_handler) all forward to Psr\Log\LoggerInterface via the DI container. Pre-DI calls (from CI3's very-early bootstrap, before the container is built) fall back to error_log().
_error_handler and _exception_handler also carry a second responsibility beyond logging: they can halt the request. See "Fatal error / exception termination" below.
Where things live
| File | Responsibility |
|---|---|
application/helpers/log_helper.php | Defines the four CI3-override functions, the _log_helper_build_formatter() factory (which also installs the stack-trace parser that strips frame arguments), the private dispatcher _logger_dispatch_or_fallback(), _log_helper_fatal_exit() — the helper that sends HTTP 500 and calls exit(1) after a fatal error or uncaught exception is logged — and _log_helper_report_deprecation(), the opt-in deprecation report called from _error_handler (:256-326, call at :351). |
src/Logger/ExceptionLogContext.php | final class with one static method, fromThrowable(\Throwable $e): array. Builds the log context for a caught exception from the exception class, file, line, an argument-free frame list and the previous-exception chain. Never reads a frame's args. See "Exception logging without frame arguments" below. |
application/config/container/logger.php | DI configurator. Registers Monolog\Logger via AppLoggerFactory::create and binds it to Psr\Log\LoggerInterface. |
src/Logger/AppLoggerFactory.php | Static factory invoked by the DI configurator. Builds the Monolog\Logger instance, pushes the introspection processor, and constructs handlers. |
src/Logger/AppIntrospectionProcessor.php | Subclass of Monolog's IntrospectionProcessor that ALSO skips our CI3-override helper functions, so caller-info points at the real call site. |
src/Logger/NamedLoggerInterface.php | Subinterface of Psr\Log\LoggerInterface that adds the withName(string $name): static contract. The DI container resolves both interfaces to the same Monolog\Logger instance. Components that call withName() should depend on this interface for type-safety. |
application/config/monolog.php | Single channel ('app'). Two flat configs: file-mode (default, LineFormatter) and stdout-mode (MONOLOG_CHANNEL_CONFIGURATION=STDOUT, JsonFormatter, level-split across stdout/stderr). |
public/index.php | Loads the helper file before CI3 boots (line 289), then loads system/core/CodeIgniter.php (line 299). |
application/core/Log.php | Defensive stub (class CI_Log) that throws on construction. Kept as a tripwire for any future code that calls load_class('Log', 'core'). |
Fatal error / exception termination
_error_handler and _exception_handler (application/helpers/log_helper.php:335-359 and :370-377) do more than log. After logging, each calls the helper _log_helper_fatal_exit() (defined behind a function_exists() guard, application/helpers/log_helper.php:226-240), which sends HTTP 500 and halts the process:
php
function _log_helper_fatal_exit(): void
{
is_cli() or set_status_header(500);
exit(1);
}_error_handlercalls it only when the triggering severity matches the fatal maskE_ERROR | E_PARSE | E_COMPILE_ERROR | E_CORE_ERROR(application/helpers/log_helper.php:356-358)._exception_handlercalls it unconditionally, for every uncaught exception (application/helpers/log_helper.php:376).
This mirrors CodeIgniter 3's own (dormant) _exception_handler in system/core/Common.php:533 (is_cli() or set_status_header(500);) and :539 (exit(1);) — our override reproduces the same termination behavior that CI3 would have applied if its definitions weren't shadowed by ours (see "CI3 functions in system/core/Common.php" below).
_log_helper_fatal_exit() is defined behind a function_exists() guard so a test bootstrap can pre-declare a non-exiting stand-in instead of actually terminating the PHPUnit process: tests/bootstrap.php requires tests/Support/log_helper_fatal_exit_shim.php before any suite runs, and tests/Unit/Logger/LogHelperHandlersTest.php exercises the handlers against that shim. The design rationale for making _error_handler / _exception_handler return HTTP 500 lives in docs/decisions/543-exception-handler-status-500.md.
Deprecation report (#973)
When APP_LOG_DEPRECATIONS=true, _error_handler also calls _log_helper_report_deprecation() (application/helpers/log_helper.php:256-326, call at :351). It appends one line per distinct E_DEPRECATED / E_USER_DEPRECATED ([date] E_DEPRECATED: message in file:line, newlines collapsed, secrets redacted through _log_helper_redact_secrets()) to APP_LOG_DEPRECATIONS_FILE, default application/logs/deprecations.log; php://stderr works for stdout/K8s tenants (:283-318).
- Each distinct
severity|file:line|messageis written once per process (:300-304). - It ignores
error_reporting(), so@-suppressed deprecations are reported too (:263-265). - Write failures are silent, because the function must never throw or warn inside the error handler (
:313-324). - Unset, or any value other than
true, means off. The env keys are read at call time from$_SERVER/$_ENV(:287-292); both are listed in.env.example:10-15.
Exception logging without frame arguments
Since 4.128.0 (ecommercen#524), exception logging no longer writes the arguments of stack frames. Two CI3 core sites remain (see Known Issues & Security Gaps). Before, a REST action that threw while a frame held a registering customer's plaintext password, email, name or mobile number, or an ApcoPay gateway payload, wrote those values to application/logs/ on any host running zend.exception_ignore_args = Off. With that setting a getTrace() frame carries an args key, and getTraceAsString() prints scalar arguments truncated to 15 characters, so neither is safe to log (src/Logger/ExceptionLogContext.php:10-13). The Docker base config ships zend.exception_ignore_args = On (.docker/configs/1.0.0-8.1.34.php_base.php.ini:379) and the integration compose config ships Off (.docker/integration/configs/php.ini:379).
What a log line still carries for an exception: the exception message as-is, the exception class, its file and line, one line per frame with the call name only, and the previous-exception chain. What changes for a REST client: nothing. An uncaught throwable in a REST action still answers HTTP 500 {"message":"Internal server error."} (src/Rest/Support/SafeActionDispatch.php:58-62).
Two mechanisms do this. One covers code that catches an exception and logs it; the other covers every Throwable that reaches the line formatter.
1. ExceptionLogContext::fromThrowable() for caught exceptions. src/Logger/ExceptionLogContext.php:20-52 returns ['exception' => <class>, 'file' => <file>, 'line' => <line>, 'trace' => list<string>], plus 'previous' (class, file, line and message of each chained exception) when there is a chain (:38-49). Each trace entry is rebuilt from the frame's file, line, class, type and function keys only, as #<i> <file>(<line>): <class><type><function>(); a frame without a file renders as [internal function] (:23-29). It returns plain strings, so the pre-DI error_log() fallback (json_encode($context), application/helpers/log_helper.php:168-173) renders it as fully as Monolog does. The call sites:
| Call site | What it logs |
|---|---|
application/controllers/RouterDispatcher.php:74 | Dispatcher error: <message> with the context, when the REST controller cannot be resolved from DI |
application/controllers/RouterDispatcher.php:118 | Middleware error: <message> with the context |
src/Rest/Support/SafeActionDispatch.php:55 | Dispatcher error: <message> with the context, for any Throwable a REST action throws |
src/ApcoPay/ApcoPay.php:54-57 | ApcoPay::validateResponse <message> with the context, then rethrows |
src/ApcoPay/Response.php:66-72 | Keeps its list-of-strings context: libxml error, message, exception class, exception at <file>:<line>, and exception trace built from fromThrowable()['trace'] |
ecommercen/checkout/controllers/Adv_checkout.php:2945-2949 (apcopay_status()) | Everything in the message string: message, Exception <class> at <file>:<line>, and Trace built from fromThrowable()['trace'] |
system/core/Common.php:528-530 (CI3's _exception_handler()) | Passes fromThrowable() to log_exception() when the class can be loaded, otherwise []. It never falls back to getTrace(). This copy is dormant in main (see "CI3 functions in system/core/Common.php" below) |
2. The line formatter's stack-trace parser for every other Throwable. The uncaught-exception handler that actually runs, _exception_handler() in application/helpers/log_helper.php:370-377, passes the Throwable itself as ['exception' => $exception], and any other code may do the same. Monolog's LineFormatter renders such a Throwable's [stacktrace] from getTraceAsString(), for the exception and for each previous exception (vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php:203-219, :283-285, :290-300). _log_helper_build_formatter() passes a parser closure to includeStacktraces(true, $parser) (application/helpers/log_helper.php:48-60) that rewrites each line:
#<n> <file>(<line>): <call>(<args>)→#<n> <file>(<line>): <call>()(:49-51)#<n> [internal function]: <call>(<args>)→#<n> [internal function]: <call>()(:52-54)#<n> {main}is kept (:55-57)- any other line is dropped, not passed through (
:59)
PHP 8.4+ names closures {closure:Class::method():N}, so the call name can contain parentheses (#977). The parser uses $callName = '(?:[^(]*?\{closure:.*?:\d+\}|[^(]*)' (application/helpers/log_helper.php:44-47) so the full closure name is kept and the arguments are still stripped.
The JSON formatter used in STDOUT mode needs no parser: Monolog's NormalizerFormatter::normalizeException() builds trace from each frame's file:line only (vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php:293-302), and JsonFormatter keeps that list when includeStacktraces is true (vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php:225-233).
The caller-info processor never sees arguments either: AppIntrospectionProcessor reads debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) (src/Logger/AppIntrospectionProcessor.php:45).
Rules for new code:
- Never pass
$e->getTrace()or$e->getTraceAsString()to a logger, as context or inside the message. Use\Advisable\Logger\ExceptionLogContext::fromThrowable($e)as the context, orimplode("\n", ExceptionLogContext::fromThrowable($e)['trace'])where the log call takes a string. - Passing the Throwable itself as
['exception' => $e]is also safe through the Monolog path, because both formatters render it without arguments. - The exception message is logged as-is. Do not put a secret into an exception message.
Canonical injection patterns
Modern src/ class (preferred — constructor injection)
php
namespace Advisable\YourComponent;
use Advisable\Logger\NamedLoggerInterface;
class YourComponent
{
private \Advisable\Logger\NamedLoggerInterface $logger;
public function __construct(\Advisable\Logger\NamedLoggerInterface $logger /* + your other deps */)
{
$this->logger = $logger->withName('your-component');
}
public function doWork(): void
{
$this->logger->info('did the work', ['foo' => 'bar']);
}
}The withName('your-component') call sets the %channel% field for every record this instance emits — that's how you get a tagged channel string for filtering in Grafana or tail -f log.php | grep your-component.
Choosing between LoggerInterface and NamedLoggerInterface:
- If your component will tag its records via
withName('component'), depend onAdvisable\Logger\NamedLoggerInterface— it includes the channel-tagging contract. - If your component just logs without tagging, depend on
Psr\Log\LoggerInterfacefor the cleanest PSR-3 surface. Test mocks are simpler against the bare PSR-3 interface. - The DI container resolves both to the same
Monolog\Loggerinstance.
If your component doesn't need a permanent identity (e.g. a controller method that handles many concerns), skip withName() and pass per-call tags via structured context: $this->logger->error('msg', ['component' => 'something']);.
Legacy CI3 controller / model / library (lazy di() lookup)
php
class Some_controller extends MY_Controller
{
private ?\Advisable\Logger\NamedLoggerInterface $logger = null;
private function logger(): \Advisable\Logger\NamedLoggerInterface
{
return $this->logger ??= di()->get(\Advisable\Logger\NamedLoggerInterface::class)->withName('some');
}
public function index()
{
$this->logger()->error('boom', ['cart_id' => 42]);
}
}CI3 controllers are instantiated by the framework's HMVC loader, so constructor injection from Symfony DI is not available. The lazy property avoids the cost of resolving the logger on every request — only when the controller actually logs.
Plain log_message() (no migration needed)
php
log_message('error', 'something happened', ['key' => 'value']);Continues to work everywhere. Routes through PSR-3 like everything else, but the resulting record has the default channel string (env('ENVIRONMENT')) and no per-call component tag unless you put one in the context array.
Migrating existing call sites
Migration coverage:
- All
new CodeIgniterLogger()instantiations have been migrated (44 sites acrosssrc/,application/,ecommercen/). Each migrated class either constructor-injectsNamedLoggerInterface(modernsrc/classes) or uses the lazydi()accessor (legacy CI3 classes). - Three worked-example
log_message()migrations:Adv_checkout.php,src/Public/PublicOrders.php,src/Moosend/Moosend.php. - The remaining
log_message()callers — approximately 180 sites acrossapplication/andecommercen/— continue to route through the global helper override and produce records with the default channel string. Migration is incremental.
Migrate remaining log_message() call sites opportunistically:
- When you're touching the file for another reason
- When the file is high-traffic enough that a tagged channel string would make Grafana queries cleaner
- When you're moving the file from
application//ecommercen/tosrc/anyway
Single-line guarantee
Every log record emitted by the platform's logger occupies exactly one physical line.
File mode (MONOLOG_CHANNEL_CONFIGURATION unset / STANDARD): Monolog's LineFormatter with allowInlineLineBreaks=false. Embedded newlines in messages or stack traces collapse to a single space. The factory function _log_helper_build_formatter() is the single source of truth.
STDOUT mode (MONOLOG_CHANNEL_CONFIGURATION=STDOUT): Monolog's JsonFormatter with appendNewline=true and includeStacktraces=true. Each record renders as one JSON object terminated by \n. JSON guarantees no embedded literal newlines (they are encoded as \n inside string values), so the single-line property is structurally enforced. See Output formats for the full rationale.
This is enforced by tests/Unit/Logger/CoreLoggerFormatTest.php (line formatter contract), tests/Unit/Logger/AppLoggerFactoryTest.php (JSON shape and level routing), and tests/Integration/Logger/LoggerDiBindingTest.php (file mode handler stack and introspection processor).
Caller info via AppIntrospectionProcessor
Every log line carries the file/line/class/function of the actual caller — the controller / model / service / helper that called $logger->error(...) or log_message(...). The processor is a small subclass of Monolog's IntrospectionProcessor that adds the four CI3-override helper functions (log_message, _error_handler, _exception_handler, _shutdown_handler) and the private dispatcher (_logger_dispatch_or_fallback) to its skip set. Monolog's stock processor only skips class frames matching skipClassesPartials plus a hardcoded call_user_func / call_user_func_array set; user-supplied function names are not honoured. Without the subclass, every record routed through log_message() would report _logger_dispatch_or_fallback as the source.
If you see log_helper.php or Monolog\ reported as the caller, the skip logic is wrong — investigate src/Logger/AppIntrospectionProcessor.php.
Output formats
The factory selects a formatter per handler from the format key in application/config/monolog.php. Two formats are supported:
format | Formatter | Used in | Why |
|---|---|---|---|
line | Monolog\Formatter\LineFormatter (built via _log_helper_build_formatter()) | File mode (rotating local file) | Human-readable for tail -f during development. |
json | Monolog\Formatter\JsonFormatter with includeStacktraces=true | STDOUT mode (K8s) | Loki/Grafana/Datadog/CloudWatch parse JSON natively at ingest, so queries like level=ERROR channel=klarna context.cart_id=42 resolve against indexed fields rather than line-pattern regex. |
JSON output preserves the single-line guarantee structurally — embedded newlines inside string values are JSON-escaped to \n, and one record corresponds to exactly one physical line. Stack traces in context.exception are flattened into the same record.
Neither format writes stack-frame arguments: the line formatter strips them with its stack-trace parser, and the json formatter lists frames as file:line only (see "Exception logging without frame arguments" above).
A custom lineFormat template per handler is only honoured when format is line. The JSON formatter has no template; field names are fixed by Monolog (message, level, level_name, channel, datetime, context, extra).
stdout / stderr split (12-factor)
In STDOUT mode each record routes to exactly one stream:
| Level | Stream | Pipeline |
|---|---|---|
Debug, Info, Notice, Warning | stdout | FilterHandler(Debug..Warning) → ChannelThresholdHandler → StreamHandler('php://stdout') |
Error, Critical, Alert, Emergency | stderr | FilterHandler(Error..Emergency) → ChannelThresholdHandler → StreamHandler('php://stderr') |
FilterHandler sits at the top of the pipeline so a record outside the level range bubbles to the next pipeline without paying the per-channel-gate cost. Records appear once on the stream that matches their severity and never on the other.
Wrapping order is deliberate:
FilterHandleroutermost — picks WHICH stream this pipeline writes to.ChannelThresholdHandlermiddle — applies the per-channel admit/suppress decision.StreamHandlerinnermost — emits the formatted line to the actual stream.
K8s collects stdout and stderr separately. Grafana/Loki queries can partition {stream="stderr"} for alerting and {stream="stdout"} for diagnostic browsing. CLI tools (kubectl logs --all-containers, docker logs) consume both streams unmodified.
Per-channel thresholds
The platform-default threshold in application/config/monolog.php applies to every channel that isn't explicitly mapped. To override the default for specific components, list them under channelThresholds:
php
'channelThresholds' => [
'klarna' => 'DEBUG', // verbose Klarna trace during a payment-gateway investigation
'transporter-elta' => 'WARNING', // ELTA tracking calls — quiet info-level chatter
'matomo' => 'CRITICAL', // Matomo is noisy in development; only log fatal issues
],Channels mapped here override the platform default both ways — you can EITHER admit lower-severity records than the platform default (e.g. klarna at DEBUG while the platform default is NOTICE) OR raise the bar (e.g. matomo at CRITICAL to silence info/warning noise).
Mechanism: Advisable\Logger\ChannelThresholdHandler decorates each handler in the Logger. The decorator inspects $record->channel against the map and either delegates to the wrapped handler or returns false (suppress). The wrapped handler itself accepts Level::Debug so the decorator can raise OR lower the effective threshold; with the decorator in place, the wrapped handler's threshold is irrelevant.
Runtime override via env var
APP_LOG_CHANNEL_OVERRIDES accepts a JSON object that merges on top of the static map at config-load time. Useful for temporary debug sessions in K8s without a redeploy:
bash
APP_LOG_CHANNEL_OVERRIDES='{"klarna":"DEBUG","transporter-elta":"DEBUG"}'The merge is shallow — env-var entries replace map entries with the same key. To clear an override after debugging, restart the pod with the env var unset (or empty {}).
CI3 functions in system/core/Common.php
CI3's bundled definitions of log_message, _error_handler, _exception_handler, _shutdown_handler (behind function_exists() guards in system/core/Common.php) are dormant in this codebase. Our application/helpers/log_helper.php defines all four before CI3 loads. Don't be confused if you read Common.php and see the CI3 bodies — they're never called.
One of those bodies is not stock CI3: _exception_handler() in system/core/Common.php:509-541 passes ExceptionLogContext::fromThrowable() to log_exception() behind a class_exists() guard (:528-530) instead of the full getTrace(). It does not run in main; the change protects a fork that does not load log_helper.php.
What about the named channel services?
There used to be deferred_task.logger and project_agora.logger in DI, each a CoreLogger configured for its own log file. Both are gone. Their consumers (DeferredTaskRunner, ProjectAgoraFactory) now take the autowired LoggerInterface and call withName() to preserve the channel string in formatted output. Same observable shape, one fewer parallel logger.
Known Issues & Security Gaps
- The remaining
log_message()callers (acrossapplication/andecommercen/) have not been individually migrated. They work through the global helper override and produce records with the default channel string. Migration is incremental. application/helpers/farmakon_helper.php(11log_message()calls) is a CI3 helper file (not a class). Migration would require either converting it to a class withLoggerInterfaceinjection, or accepting the per-call context-tagging pattern. Not done in this work.Psr\Log\LoggerInterfacemocks in tests cannot callwithName(). If a consumer types its constructor asNamedLoggerInterface, mocks must implement the named interface (e.g. an anonymous class withwithName()returning$this) or use a realMonolog\Logger. Existing tests for the migrated consumers (e.g.tests/Unit/DeferredTask/DeferredTaskRunnerTest.php) demonstrate this pattern.- Logs written before 4.128.0 may still hold passwords and personal data. #524 stops new leaks only; it does not touch existing files under
application/logs/or logs already shipped to an aggregator from a host that ranzend.exception_ignore_args = Off. Purging or rotating them, and deciding which environments are affected, is the ops follow-up #937. - The exception message is logged unredacted. Every #524 site still logs
$e->getMessage()as-is (e.g.src/Rest/Support/SafeActionDispatch.php:55), and the line formatter prints the message of every Throwable in a context. The #211 redactor (_log_helper_redact_secrets(),application/helpers/log_helper.php:89-133) masks only credential-shaped keys and URL userinfo, not personal data. A message that embeds a value therefore still reaches the log: a GuzzleConnectExceptionmessage ends with the request URI, query string included, which is why #945 had to keepBulkerSms'sauth_keyout of its log by hand (tests/Unit/Http/ConnectExceptionHandlingTest.php:41-43,:295-304). - Two CI3 core sites still log the full
getTrace()as context:system/core/Security.php:549(get_random_bytes()) andsystem/libraries/Encryption.php:271(create_key()), both only whenrandom_bytes()throws. #524 left them because the failing call's own argument is an integer length. ButgetTrace()holds every frame up the stack, not only the failing one.create_key()is called from_openssl_encrypt($data, $params)and_mcrypt_encrypt($data, $params)(system/libraries/Encryption.php:342,:397), andencrypt()hands those methods the plaintext and a$paramsarray whosekeyit has just set to the derived encryption key (system/libraries/Encryption.php:292-305). On that failure the trace context would carry both. The context is an array, so the line formatter's parser does not apply, and the JSON formatter normalises theargstoo. Low likelihood (it needs a broken CSPRNG), but the site breaks the "no frame arguments" rule. - A pre-DI uncaught exception is logged without its class, file or line. In the
error_log()fallback,_exception_handler()'s['exception' => $exception]context goes throughjson_encode()(application/helpers/log_helper.php:168-173,:372-374), and a Throwable has no public properties, so it encodes as{}. Nothing leaks, but only the message survives.fromThrowable()would keep the details, and the decision record cites this{}result as the reason it did not use['exception' => $e]at its sites.
Tests
| Test | Covers |
|---|---|
tests/Unit/Logger/CoreLoggerFormatTest.php | Line formatter contract (single-line output) |
tests/Unit/Logger/AppLoggerFactoryTest.php | JSON shape and level routing |
tests/Unit/Logger/ChannelThresholdHandlerTest.php | Per-channel admit/suppress decision |
tests/Unit/Logger/LogHelperHandlersTest.php | The CI3-override handlers against the non-exiting _log_helper_fatal_exit() shim, and the APP_LOG_DEPRECATIONS report (_log_helper_report_deprecation, testDeprecationReport* at tests/Unit/Logger/LogHelperHandlersTest.php:478-568) |
tests/Integration/Logger/LoggerDiBindingTest.php | File-mode handler stack and introspection processor |
tests/Unit/Logger/ExceptionLogContextTest.php | fromThrowable(): a string argument and an array argument with a password key never appear; line matches the throw site; the previous chain is rendered; a frame without a file (an array_map() callback) renders as [internal function] |
tests/Unit/Logger/StacktraceArgumentStrippingTest.php | The line formatter strips frame arguments, including those of previous exceptions and of closure (including PHP 8.4+ {closure:...} frame names, #977) and internal-function frames; the JSON formatter never renders them. Asserts that no prefix of 5 characters or more of the secret appears |
tests/Unit/ApcoPay/ResponseTraceLoggingTest.php | ApcoPay\Response::validateResponse() logs its trace without frame arguments |
tests/Unit/Rest/Support/SafeActionDispatchTest.php | #462: a throwing REST action answers 500 JSON. #524: test_logged_context_carries_no_frame_arguments |
tests/Unit/Http/ConnectExceptionHandlingTest.php | #945: a Guzzle ConnectException takes each client's no-response path; bulker_never_logs_its_auth_key asserts the logged message and context omit the key |
The #524 tests set zend.exception_ignore_args = 0 for their duration and skip when it cannot be changed at runtime (e.g. tests/Unit/Logger/StacktraceArgumentStrippingTest.php:34-49). No test asserts the logged context of RouterDispatcher's two catches, of ApcoPay::validateResponse() or of Adv_checkout::apcopay_status().
See also
- Tests: see the Tests table above
- Decision record:
docs/decisions/524-trace-args-log-leak.md - Exception context builder:
src/Logger/ExceptionLogContext.php - DI registration:
application/config/container/logger.php - Factory:
src/Logger/AppLoggerFactory.php - Named logger interface:
src/Logger/NamedLoggerInterface.php - Custom processor:
src/Logger/AppIntrospectionProcessor.php - Helper functions:
application/helpers/log_helper.php