Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console log is flooded with report portal events #113

Open
anatolysakhno opened this issue Jul 7, 2023 · 5 comments
Open

Console log is flooded with report portal events #113

anatolysakhno opened this issue Jul 7, 2023 · 5 comments
Assignees
Milestone

Comments

@anatolysakhno
Copy link

Console log is flooded with report portal events like follwing
{"type":"rp:addLog","data":{"level":"TRACE","message":"[7/7/2023 1:08:19 PM] WARNING: Not logged out"}}
can it be disabled?

@viktor-maksymenko
Copy link

We have the same issues because these messages are sent to the logging system and are redundant.

I noticed that ReportingApi sends commands (addLog, setTestCaseId, etc.) to the stdout

src/reportingApi.ts

  log: (
    level: LOG_LEVELS = LOG_LEVELS.INFO,
    message = '',
    file?: Attachment,
    suite?: string,
  ): void => sendEventToReporter(EVENTS.ADD_LOG, { level, message, file }, suite),

src/utils.ts

export const sendEventToReporter = (type: string, data: any, suite?: string): void => {
  process.stdout.write(JSON.stringify({ type, data, suite }));
};

And then there's this method in src/reporter.ts that reads stdout:

onStdOut(chunk: string | Buffer, test?: TestCase): void {
    try {
      const { type, data, suite: suiteName } = JSON.parse(String(chunk));

      switch (type) {
        
... 

        case EVENTS.SET_TEST_CASE_ID:
          this.setTestCaseId(data, test, suiteName);
          break;
      
... 

        case EVENTS.ADD_LOG:
          this.sendTestItemLog(data, test, suiteName);
          break;

...
      }
    } catch (e) {
      if (test) {
        this.sendTestItemLog({ message: String(chunk) }, test);
      }
    }
  }

I wonder why the events should be printed to the stdout. Maybe @AmsterGet can provide some details

@AmsterGet
Copy link
Member

Hi @viktor-maksymenko !
Please check this comment.
At the moment attachments and logs are already available through the native Playwright API.
We are going to implement attaching the rest of the additional data via testInfo.annotations to avoid this kind of flooding in the near future (ETA is ~1 month).
I'll post it in this thread as soon as it's ready.

@AmsterGet AmsterGet self-assigned this Jun 24, 2024
@AmsterGet AmsterGet added this to the 5.2.0 milestone Jun 24, 2024
@jatinmakhija
Copy link

Hello @AmsterGet is there any update on the possibility to reduce or switch off the console logs, especially for addAttributes?

@valerii-lukomskyi
Copy link

Hello @AmsterGet! I'm joining the conversation with the same issue as gentlemen above.
Any ReportingApi call (like addAttributes() or setTestCaseId()) is logged in my terminal when I run the test locally. Any idea how to avoid that?

@AmsterGet
Copy link
Member

Hi @valerii-lukomskyi, thanks for pinging me up!
Our priorities are constantly changing, but the solution of this issue is still on our roadmap.
I can't give you a specific timeline right now, but I will try to reassess priorities in a fortnight to determine a realistic ETA.

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

No branches or pull requests

5 participants