Question: how to enable JSON logging in Faust?

Aperta
#468 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
15/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
observability

Direzione di ricerca

Start with the loghandlers and logging_config arguments passed to faust.App, and check whether Faust's own logger setup replaces the handlers or formatters the user supplies. Reproduce with a minimal app that logs through a JSON formatter, then see which Faust log lines still come out as plain text. Done means either a working configuration documented for Faust users or a clear answer about what Faust does with logging settings. The thread has been idle for about three years, so confirm the maintainers still want an answer before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

question

Hi,

I would like to ask, how can I jsonify the output of Faust?

I have tried to set logHandler of Faust with json-formatted log handler from pythonjsonlogger:

from pythonjsonlogger import jsonlogger

logHandler = logging.StreamHandler()
formatter = jsonlogger.JsonFormatter()
logHandler.setFormatter(formatter)

app = faust.App(
           ...,
           loghandlers=[logHandler],
)

But, this does not jsonify the output of Faust.

Also, I have tried to use jsonlogger in my root log config, as specified in here.
Afterwards, I pass the log config dictionary (logging.config.dictConfig()) to the logging_config parameter, as in

app = faust.App(
           ...,
           logging_config =json_log_dict_config,
)

However, this does not seem to jsonify Faust log as well.

The faust-streaming release which I am using is "0.10.1".

Could you help me to resolve this issue?

Thank you very much for your help!

Checklist

  • I have included information about relevant versions
  • I have verified that the issue persists when using the master branch of Faust.

Versions

  • Python version: 3.10
  • Faust version: 0.10.1
  • Operating system
  • Kafka version
  • RocksDB version (if applicable)
Lingua principale
Python
Stelle
1.9k
Fork
205
Merge medio
2h 2m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di faust-streaming/faust

Tutte le issue di faust-streaming/faust

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.