Projet

Général

Profil

Bug #30890

logging journald vs unicode

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

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Catégorie:
-
Version cible:
-
Début:
25 février 2019
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Logged from file requests_wrapper.py, line 69
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/hobo/journal.py", line 200, in emit
    **extras)
  File "/usr/lib/python2.7/dist-packages/hobo/journal.py", line 89, in send
    args.extend(_make_line(key, val) for key, val in kwargs.items())
  File "/usr/lib/python2.7/dist-packages/hobo/journal.py", line 89, in <genexpr>
    args.extend(_make_line(key, val) for key, val in kwargs.items())
  File "/usr/lib/python2.7/dist-packages/hobo/journal.py", line 42, in _make_line
    return field + '=' + str(value)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 2: ordinal not in range(128)

(trouvé dans un daemon.log, process uwsgi à l'origine)


Fichiers

Révisions associées

Révision 5264b1c6 (diff)
Ajouté par Frédéric Péters il y a environ 5 ans

misc: allow journald logging of unicode strings (#30890)

Historique

#1

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

Si jamais c'est unicode, ça fera une chaine globalement unicode et ça sera envoyé et géré correctement dans l'appel sendv, qui gère l'encodage,

                if (PyUnicode_Check(item)) {
                        encoded[i] = PyUnicode_AsEncodedString(item, "utf-8", "strict");
                        if (encoded[i] == NULL)
                                goto out;
                        item = encoded[i];
                }
#2

Mis à jour par Christophe Siraut il y a environ 5 ans

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

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

  • Statut changé de Solution validée à Résolu (à déployer)
commit 5264b1c6e036cc667dccabd17e2e0abff3bec763
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Mon Feb 25 21:41:11 2019 +0100

    misc: allow journald logging of unicode strings (#30890)
#4

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

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

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

basestring n'existe pas en python3, pas très grave pour l'instant.

Formats disponibles : Atom PDF