Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5134
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Julian <mail.python.org@gethmann.org> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] Mehrzeiliges Logging |
| Date | Wed, 14 Mar 2018 14:18:23 +0100 |
| Lines | 84 |
| Message-ID | <mailman.69.1521033516.1867.python-de@python.org> (permalink) |
| References | <3218a53d-27df-83f4-4577-c4b13da330ec@thomas-guettler.de> <8a546f33-0686-5672-12aa-ada19435b752@thomas-guettler.de> <820d7f52-a740-4ed8-a55a-8e343964db0c@gethmann.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de FGQI0Mgw/XLuGIGrQ5AncQWSSYdOHWSO4q5QPOJgTQ9g== |
| Return-Path | <mail.python.org@gethmann.org> |
| X-Original-To | python-de@python.org |
| Delivered-To | python-de@mail.python.org |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
| In-Reply-To | <8a546f33-0686-5672-12aa-ada19435b752@thomas-guettler.de> |
| Content-Language | en-MW |
| X-BeenThere | python-de@python.org |
| X-Mailman-Version | 2.1.26 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-de/> |
| List-Post | <mailto:python-de@python.org> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <820d7f52-a740-4ed8-a55a-8e343964db0c@gethmann.org> |
| X-Mailman-Original-References | <3218a53d-27df-83f4-4577-c4b13da330ec@thomas-guettler.de> <8a546f33-0686-5672-12aa-ada19435b752@thomas-guettler.de> |
| Xref | csiph.com de.comp.lang.python:5134 |
Show key headers only | View raw
Hallo,
ich hoffe es ist nicht zu off-topic oder an deinen Wünschen vorbei, aber
gwenview (ein in C++ geschriebener Bildbetrachter von KDE) loggt
mehrzeilig und wenn ich journald nutze, kümmert muss ich mich auch nicht
extra darum kümmern.
Für Linux mit journald kann man folglich einfach
``` Python
from systemd import journal
journal.send("Hallo\nWelt")
```
schreiben oder den JournalHandler verwenden und der Zeilenumbruch wird
zwar ohne zusätzliches "INFO" o.ä. dargestellt, jedoch als ein Eintrag
angesehen:
``` sh
~ journalctl -e -n1 -t python3
Mar 14 14:08:53 localhost python3[24423]: Hallo
Welt
```
Leider habe ich selbst keine Erfahrung diesbezüglich.
Mit freundlichen Grüßen
Julian
On 03/14/2018 09:56 AM, Thomas Güttler wrote:
> Hallo Liste,
>
> bis jetzt sind zwei Antworten da: zweimal wird JSON erwähnt. Danke für
> die Reaktion. Ja, json klingt plausibel.
>
> Zwischen den Zeilen lese ich, dass aber bisher noch keine Erfahrung ist
> der Praxis vorliegt.
>
> Mal ganz dumm gefragt: Wer hat damit (oder einen anderen Lösung)
> praktische Erfahrung und kann
> vielleicht mal "Aus dem Nähkästchen plaudern"?
>
> Gruß,
> Thomas
>
> Am 13.03.2018 um 14:30 schrieb Thomas Güttler:
>> Hallo,
>>
>> seit Jahren verwende ich das unter Unix übliche einzeilige Logging.
>>
>> Also ein Aufruf von "logging.info()" wird genau zu einer Zeile im
>> Log-File.
>>
>> Ich hätte gerne in Zukunft mehrzeiliges Logging.
>>
>>
>> Beispiel: logging.info('foo\nbar')
>>
>> Wie soll 'foo\nbar' nun auf Platte gespeichert werden? Welches Format
>> bietet sich an?
>>
>> Sicherlich muss ich dann meine Tools anpassen, die die Logs bisher
>> auswerten. Aber das ist machbar.
>>
>> Ich bin nun unsicher ob es hier einen "sane default" gibt.
>>
>> Die Lösungen, die ich hier gefunden habe, die fühlen sich für mich wie
>> eine "Bastellösung" an:
>>
>>
>> https://stackoverflow.com/questions/49049044/python-setup-of-logging-allowing-multiline-strings-logging-infofoo-nbar
>>
>>
>> Ich möchte aber keine Bastellösung. Ich würde gerne einen Weg gehen,
>> der von tausend anderen Python-Entwicklern
>> auch gegangen wird. Es kann doch nicht sein, dass ich der erste bin,
>> der das will, oder?
>>
>>
>> Gruß,
>> Thomas
>>
>>
>>
>
Back to de.comp.lang.python | Previous | Next | Find similar
Re: [Python-de] Mehrzeiliges Logging Julian <mail.python.org@gethmann.org> - 2018-03-14 14:18 +0100
csiph-web