Skip to content

Truncate oversized log messages before sending to server#925

Open
dukenv0307 wants to merge 4 commits into
Expensify:mainfrom
dukenv0307:fix/655280
Open

Truncate oversized log messages before sending to server#925
dukenv0307 wants to merge 4 commits into
Expensify:mainfrom
dukenv0307:fix/655280

Conversation

@dukenv0307

@dukenv0307 dukenv0307 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/655280

Tests

  1. In https://github.com/Expensify/App/blob/main/src/libs/Log.ts, add
if (typeof window !== 'undefined') {
    (window as unknown as {TestLog: typeof Log}).TestLog = Log;
}
  1. In https://github.com/Expensify/Web-Expensify/blob/77dce47f0cdae88d1c9bfcd57987c241883a07bb/lib/LogAPI.php#L54, add
if (preg_match('/\[truncated \d+ characters\]$/', $log['message'])) {
                    self::info('Received truncated client log message', ['length' => strlen($log['message'])]);
                }
  1. Run App, open the browser console, and run
window.TestLog.info('X'.repeat(2 * 1024 * 1024), true);
  1. Verify Received truncated client log message is shown in the log
Screenshot 2026-07-03 at 6 57 49 PM

QA

N/A

@dukenv0307 dukenv0307 marked this pull request as ready for review July 3, 2026 12:03
@dukenv0307 dukenv0307 requested a review from a team as a code owner July 3, 2026 12:03
@melvin-bot melvin-bot Bot requested review from aldo-expensify and removed request for a team July 3, 2026 12:04
@dukenv0307

Copy link
Copy Markdown
Contributor Author

@robertjchen could you please review this PR?

@robertjchen robertjchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

3 participants