[issue29675] SysLogHandler does not seem to always expand %(loglevel)s properly

2017-02-28 Thread Vinay Sajip

Vinay Sajip added the comment:

This is not a bug - logging is formatting the message as per the specified 
format string. It then prepends the priority and sends the result to the 
socket. What you are seeing is just how systemd/journald interpret the message 
that's sent.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29675] SysLogHandler does not seem to always expand %(loglevel)s properly

2017-02-28 Thread Q

Q added the comment:

PS. I'm not sure if that is a systemd/journald issue, or indeed a Python bug.

However, it would be nice to clear one possibility. 

For a StreamHandler, it all works as it should.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29675] SysLogHandler does not seem to always expand %(loglevel)s properly

2017-02-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +vinay.sajip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29675] SysLogHandler does not seem to always expand %(loglevel)s properly

2017-02-28 Thread Q

Q added the comment:

Attaching the other file mentioned.

--
Added file: http://bugs.python.org/file46680/good.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29675] SysLogHandler does not seem to always expand %(loglevel)s properly

2017-02-28 Thread Q

New submission from Q:

On Ubuntu LTS 16.04, SysLogHandler with a custom formatter does not seem to 
expand loglevel/levelno fields properly, when there are square brackets ( see 
the attached examples ). Instead, it seems to replace '[%(loglevel)s]' with a 
'[pid]', and '%(loglevel)s' with 'LOGLEVEL[pid]' .

To test, run 'journalctl -f | grep test_test_test' on one console, and the 
attached files on another. The output for 'bad.py' looks as follows:
===
Feb 28 21:30:05 hostname [7117]: logging was configured for 
process <7117>
===

And should have looked like:
===
Feb 28 21:30:05 hostname [INFO]: logging was configured for 
process <7117>
===

For 'good.py', the output is as follows:
===
Feb 28 21:30:04 hostname INFO[7114]: logging was configured for 
process <7114>
===

and should have probably been: 
===
Feb 28 21:30:04 hostname INFO: logging was configured for 
process <7114>
===

Kind regards, /t13

--
files: bad.py
messages: 288702
nosy: thread13
priority: normal
severity: normal
status: open
title: SysLogHandler does not seem to always expand %(loglevel)s properly
versions: Python 2.7
Added file: http://bugs.python.org/file46679/bad.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com