Coder Social home page Coder Social logo

Store job logs about grimoirelab-kingarthur HOT 6 CLOSED

chaoss avatar chaoss commented on August 17, 2024
Store job logs

from grimoirelab-kingarthur.

Comments (6)

sduenas avatar sduenas commented on August 17, 2024 1

Yeah, probably that's what we need although I'm not sure about rq.worker. Probably it will be better to store arthur package too.

from grimoirelab-kingarthur.

dlumbrer avatar dlumbrer commented on August 17, 2024

I'm trying to get the worker log (that contains the logs of the jobs) in order to filter it by a Handler and save them in the corresponding meta log (just for testing, this will not be the code):

class MetaJobLogHandler(StreamHandler):
    def __init__(self, job):
        StreamHandler.__init__(self)
        self.job = job
        self.job.meta['log'] = ""
        self.current_job = None

    def emit(self, record):
        msg = self.format(record)
        if self.job.id in msg or not self.current_job:
            self.current_job = self.job
        self.current_job.meta['log'] += "{} \n".format(msg)

The problem that I faced is that the logger (logger = logging.getLogger('rq.worker')) does not contain the logs from the Perceval job, I have to find in what logger are the Perceval logs writing.

Any idea @sduenas ?

from grimoirelab-kingarthur.

dlumbrer avatar dlumbrer commented on August 17, 2024

This is the logger tree level:

<--""
   Level INFO
   Handler <ColorizingStreamHandler <stderr> (NOTSET)>
     Formatter fmt='[%(asctime)s] - %(message)s' datefmt=None
   |
   o<--"arthur"
   |   Level NOTSET so inherits level INFO
   |   Handler <NullHandler (NOTSET)>
   |   |
   |   o<--"arthur.events"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"arthur.jobs"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"arthur.worker"
   |       Level NOTSET so inherits level INFO
   |
   o<--"asyncio"
   |   Level NOTSET so inherits level INFO
   |
   o<--[concurrent]
   |   |
   |   o<--"concurrent.futures"
   |       Level NOTSET so inherits level INFO
   |
   o<--[django]
   |   |
   |   o<--"django.template"
   |       Level NOTSET so inherits level INFO
   |
   o<--"grimoirelab_toolkit"
   |   Level NOTSET so inherits level INFO
   |   Handler <NullHandler (NOTSET)>
   |   |
   |   o<--"grimoirelab_toolkit.datetime"
   |       Level NOTSET so inherits level INFO
   |
   o<--[perceval]
   |   |
   |   o<--"perceval.archive"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"perceval.backend"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--[perceval.backends]
   |   |   |
   |   |   o<--[perceval.backends.core]
   |   |       |
   |   |       o<--"perceval.backends.core.askbot"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.bugzilla"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.bugzillarest"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.confluence"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.discourse"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.dockerhub"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.gerrit"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.git"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.github"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.gitlab"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.googlehits"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.groupsio"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.hyperkitty"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.jenkins"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.jira"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.launchpad"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.mattermost"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.mbox"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.mediawiki"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.meetup"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.nntp"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.phabricator"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.pipermail"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.redmine"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.rss"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.slack"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.stackexchange"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.supybot"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.telegram"
   |   |       |   Level NOTSET so inherits level INFO
   |   |       |
   |   |       o<--"perceval.backends.core.twitter"
   |   |           Level NOTSET so inherits level INFO
   |   |
   |   o<--"perceval.client"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"perceval.utils"
   |       Level NOTSET so inherits level INFO
   |
   o<--"requests"
   |   Level WARNING
   |   Handler <NullHandler (NOTSET)>
   |
   o<--"rq"
   |   Level NOTSET so inherits level INFO
   |   Handler <MetaJobLogHandler <stderr> (INFO)>
   |     Level INFO
   |   |
   |   o<--"rq.worker"
   |       Level INFO
   |
   o<--"urllib3"
   |   Level NOTSET so inherits level INFO
   |   Handler <NullHandler (NOTSET)>
   |   |
   |   o<--"urllib3.connection"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"urllib3.connectionpool"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"urllib3.poolmanager"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--"urllib3.response"
   |   |   Level NOTSET so inherits level INFO
   |   |
   |   o<--[urllib3.util]
   |       |
   |       o<--"urllib3.util.retry"
   |           Level NOTSET so inherits level INFO
   |
   o<--"urrlib3"
       Level WARNING

from grimoirelab-kingarthur.

dlumbrer avatar dlumbrer commented on August 17, 2024

I was thinking on adding the handler to the perceval logger and rq.worker logger, it works for now.

WDYT @sduenas ?

from grimoirelab-kingarthur.

dlumbrer avatar dlumbrer commented on August 17, 2024

@sduenas I updated the PR adding more information in the log record (date, level, module, and msg for now).

Please, check it when you have time

from grimoirelab-kingarthur.

dlumbrer avatar dlumbrer commented on August 17, 2024

PR updated with some tests.

Please @sduenas , check it when you have time

from grimoirelab-kingarthur.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.