Skip to content

Truncate oversized log records#192

Merged
timkelty merged 1 commit into
3.xfrom
timkelty/truncate-oversized-logs
Jul 24, 2026
Merged

Truncate oversized log records#192
timkelty merged 1 commit into
3.xfrom
timkelty/truncate-oversized-logs

Conversation

@timkelty

Copy link
Copy Markdown
Contributor

Caps formatted Monolog records at 240 KiB before Craft streams them to Bref’s PHP-FPM runtime. The decorator preserves UTF-8 and terminal line endings while retaining each handler’s existing formatter, with focused CRLF coverage.

Copilot AI review requested due to automatic review settings July 24, 2026 02:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a Monolog formatter decorator that caps oversized formatted log output at 240 KiB (to stay under Bref/PHP-FPM log limits) and wires it into the Cloud MonologTarget handler pipeline.

Changes:

  • Added craft\cloud\TruncatingFormatter to truncate oversized formatted records while preserving UTF-8 and terminal line endings.
  • Wrapped existing Monolog handler formatters with TruncatingFormatter during MonologTarget construction in AppConfig.
  • Added a focused unit test covering truncation behavior and CRLF preservation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/TruncatingFormatter.php New formatter decorator that truncates formatted log output to a safe byte limit.
src/AppConfig.php Wraps handler formatters with the truncating decorator when creating MonologTarget.
tests/unit/TruncatingFormatterTest.php Adds unit coverage for truncation, UTF-8 validity, and CRLF preservation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/TruncatingFormatter.php
@timkelty
timkelty marked this pull request as ready for review July 24, 2026 03:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9277f64f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/TruncatingFormatter.php
@timkelty
timkelty merged commit 0301b49 into 3.x Jul 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants