Page MenuHomePhabricator

Any output to log file is not visbile on CI
Closed, ResolvedPublicBUG REPORT

Description

What happens:

If an API Error occurs during CI tests, additional informations are printed to the log file:

# raise error
try:
    param_repr = str(self._params)
    pywikibot.log('API Error: query=\n{}'
                  .format(pprint.pformat(param_repr)))
    pywikibot.log(f'           response=\n{result}')

    raise pywikibot.exceptions.APIError(**error)
except TypeError:
    raise RuntimeError(result)

https://pipelines.actions.githubusercontent.com/serviceHosts/c1f2ea67-69db-4ab9-996f-108170f99955/_apis/pipelines/1/runs/4126/signedlogcontent/25?urlExpires=2023-04-04T13%3A14%3A09.4940021Z&urlSigningMethod=HMACV1&urlSignature=RHN0%2BJ3e7eqp%2Bo%2B9UtcwU8e9jfpaIanjTYuau%2BNTjKM%3D

But the log is not reachable an the important information is lost.
The log is printed in "Generate user files" section but not in Test section.

What should have happened instead?:
Either the log should be reachable somehow or the informations should be printed to terminal

Details

Event Timeline

Xqt triaged this task as Medium priority.Apr 4 2023, 1:28 PM

Change 906730 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Add parameters to APIError to show them

https://gerrit.wikimedia.org/r/906730

Change 906730 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Add parameters to APIError to show them

https://gerrit.wikimedia.org/r/906730

Is it possible to make this behaviour configurable? It broke video2commons in an horrible way, as we serialize API errors in our redis instance, we now have keys that contain whole serialized videos (hundreds of megabytes of binary data). It's really interesting to have most of the parameters (filename, mime type and so on) but we clearly don't want to have file contents in the string representation.

Is it possible to make this behaviour configurable?

As this change was introduced mainly for CI tests I think we can make it configurable if it is difficult to filter out binaries.