Use FedmsgConsumer.log instead of custom one
ClosedPublic

Authored by mkrizek on May 13 2014, 2:37 PM.

Details

Summary

Works on my system with fedmsg-hub.service. The logs go to /var/log/messages, we'd need to change /etc/fedmsg.d/logging.py to put them in a file but that's a change outside this repo.

Fixes T103

Test Plan

None

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

This means we lose the stdout functionality but I suppose that tailing a file is functionally equivalent. Is there a sane way to use a fedmsg log file like @ralph was talking about instead of letting stuff go to /var/log/messages by default?

jobtriggers/config.py
27–29

I hadn't gotten around to filing a bug about that yet - thanks for fixing it

ralph added a comment.May 13 2014, 4:58 PM

Here's a thought: You won't get your log output until the entire trigger_job call is done. It builds a list of output strings and returns them at the end.

You could instead use yield statements in trigger_job to yield output lines and then modify KojiJobTrigger.consume to do:

output = self.trigger.trigger_job(envr, UNIT_TYPE, task, arch)
for line in output:
    self.log.info(line)

Is there a sane way to use a fedmsg log file like @ralph was talking about instead of letting stuff go to /var/log/messages by default?

I guess we'd need to do this (/etc/fedmg.d/logging.py): {F2117}

I guess we'd need to do this (/etc/fedmg.d/logging.py

That's not part of this diff, though. I wonder if we would be wise to include a logging.py in the source tree even if it wasn't installed with the package.

mkrizek updated this revision.May 15 2014, 2:13 PM
  • Use yield instead of returning all output at once
tflink requested changes to this revision.May 15 2014, 2:23 PM

Overall, the code looks good to me. One nit about the number of logging statements for buildbot but that's a minor detail.

I'd like to see the readme updated with suggested production changes to /etc/fedmsg.d/logging.py, though.

jobtriggers/triggers.py
63

I think that some of these logging statements are excessive. Status from login, force and logout in addition to url for the force request should be sufficient

mkrizek updated this revision.May 15 2014, 3:00 PM
  • readme: Add instructions
mkrizek updated this revision.May 15 2014, 3:03 PM
  • Fix typo
tflink accepted this revision.May 15 2014, 3:05 PM

Small wording change suggestion but other than that, looks good to me

readme.rst
32

one small wording suggestion: "Then replace the console handler with the filelog handler for the fedmsg logger so that log messages are sent to a separate file instead of to the console"

mkrizek closed this revision.May 15 2014, 3:17 PM

Closed by commit rTRGRed9ad67182fb (authored by @mkrizek).