Projet

Général

Profil

Bug #44029

logging des erreurs de cron

Ajouté par Frédéric Péters il y a presque 4 ans. Mis à jour il y a environ 3 ans.

Statut:
Fermé
Priorité:
Bas
Assigné à:
Version cible:
-
Début:
12 juin 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

là ça fait un mail par ligne de la trace, exemple :

  33     ( 1) jun 12 root@passerelle (   0) ERROR: TypeError: super(type, obj): obj must be an instance or subtype of type
  34     ( 1) jun 12 root@passerelle (   0) ERROR:     Thread.__init__(self)
  35     ( 1) jun 12 root@passerelle (   0) ERROR:   File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 1731, in run
  36     ( 1) jun 12 root@passerelle (   0) ERROR:   File "/usr/lib/python3.5/threading.py", line 1166, in __init__
  37     ( 1) jun 12 root@passerelle (   0) ERROR:     super(TenantAwareThread, self).__init__(*args, **kwargs)
  38     ( 1) jun 12 root@passerelle (   0) ERROR:     self.packetizer.start_handshake(self.handshake_timeout)
  39     ( 1) jun 12 root@passerelle (   0) ERROR:
  40     ( 1) jun 12 root@passerelle (   0) ERROR:   File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 201, in start_handshake
  41     ( 1) jun 12 root@passerelle (   0) ERROR:   File "/usr/lib/python3/dist-packages/hobo/multitenant/threads.py", line 34, in __init__
  42     ( 1) jun 12 root@passerelle (   0) ERROR:     self.__timer = threading.Timer(float(timeout), self.read_timer)
  43     ( 1) jun 12 root@passerelle (   0) ERROR: Traceback (most recent call last):
  44     ( 1) jun 12 root@passerelle (   0) ERROR: Unknown exception: super(type, obj): obj must be an instance or subtype of type

Fichiers

Révisions associées

Révision 650e807f (diff)
Ajouté par Serghei Mihai il y a environ 3 ans

debian: log paramiko.transports errors as debug (#44029)

Historique

#1

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

J'ai du mal à voir d'où vient ce comportement, on a un seul connector.logger.error par exception, ou alors c'est les print à la fin ?

        for app in get_all_apps():
            for connector in app.objects.all():
                if options.get('connector') and connector.get_connector_slug() != options.get('connector'):
                    continue
                if options.get('slug') and connector.slug != options.get('slug'):
                    continue
                try:
                    getattr(connector, frequency)()
                except Exception as e:
                    connector.logger.error('error running %s job (%r)' % (frequency, e))
                    errors.append({'connector': connector, 'exception': e, 'traceback': traceback.format_exc()})
        if errors:
            for error in errors:
                if options['verbosity'] >= 1:
                    print(repr(error['connector']),)
                    print('  url:', getattr(settings, 'SITE_BASE_URL', '') + error['connector'].get_absolute_url())
                    print('  error:', error['exception'])
                if options['verbosity'] >= 2:
                    print('  traceback:')
                    print(error['traceback'])
                    print()
            raise CommandError('error running jobs')

#2

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

Ça vient de paramiko, on ne peut pas faire grand chose à la source :

Faut juste désactiver le logger paramiko.transport et/ou utiliser le filtre qui rabaisse le niveau à DEBUG.

#3

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Priorité changé de Normal à Bas

Si ça revient l'idée c'est ça :

diff --git a/debian/debian_config.py b/debian/debian_config.py
index 88bb4bac..a70197ce 100644
--- a/debian/debian_config.py
+++ b/debian/debian_config.py
@@ -21,6 +21,11 @@ LOGGING['loggers']['suds'] = {
     'filters': ['require_debug_true'],
     'propagate': True,
 }
+LOGGING['loggers']['paramiko.transport'] = {
+    'level': 'DEBUG',
+    'filters': ['force_debug'],
+    'propagate': True,
+}

 exec(open('/etc/%s/settings.py' % PROJECT_NAME).read())

#5

Mis à jour par Serghei Mihai il y a environ 3 ans

Testé le paramètrage sur la prod, recette de Grenoble et Lille, ça fonctionne.

#6

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

  • Statut changé de Solution proposée à Solution validée
#7

Mis à jour par Serghei Mihai il y a environ 3 ans

  • Statut changé de Solution validée à Résolu (à déployer)
  • Assigné à mis à Serghei Mihai
commit 650e807fd2bdd4875d5c1bcc25eb556a88cba6b3 (origin/main)
Author: Serghei Mihai <smihai@entrouvert.com>
Date:   Sun Mar 21 17:42:09 2021 +0100

    debian: log paramiko.transports errors as debug (#44029)
#8

Mis à jour par Frédéric Péters il y a environ 3 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF