Skip to content

Commit

Permalink
Fix trace data not appearing in logfile in development mode
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed May 26, 2024
1 parent 539abf4 commit bc372e5
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ Web change log

## ?.?.? / ????-??-??

* Fixed trace data not appearing in logfile in development mode - @thekid
* Merged PR #115: Add `web.Headers::qfactors()`, which can be used when
implementing content negotiation
(@thekid)
4 changes: 2 additions & 2 deletions src/main/php/xp/web/WebRunner.class.php
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ private static function error($request, $response, $env, $error) {
break;
}
}
$env->logging()->log($request, $response, ['error' => $error]);
$env->logging()->log($request, $response, $response->trace + ['error' => $error]);
}

/**
@@ -83,7 +83,7 @@ public static function main($args) {
foreach ($application->service($request, $response) ?? [] as $event => $arg) {
if ('delay' === $event) usleep($arg * 1000);
}
$env->logging()->log($request, $response);
$env->logging()->log($request, $response, $response->trace);
} catch (Error $e) {
self::error($request, $response, $env, $e);
} catch (Throwable $e) {
1 change: 1 addition & 0 deletions src/main/php/xp/web/dev/Console.class.php
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ public function filter($req, $res, $invocation) {
$debug= ob_get_clean();
}

$res->trace= $buffer->trace;
$out= $buffer->output();
if (empty($debug)) {
$out->drain($res);

0 comments on commit bc372e5

Please sign in to comment.