Skip to contentSkip to conversation

log: Fix systemd journal PRIORITY field logging

PATCH Applied Ossama Othman 2 participants 2 messages Mar 9, 2017 – Mar 10, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 log: Fix systemd journal PRIORITY field logging

When logging messages to the systemd journal the trailing line feed character was truncated since the message length was incorrectly reduced by one. That resulted in the next systemd journal field, in this case PRIORITY, being written as part of the logged message string (e.g. "fooPRIORITY=6") rather than as a separate journal field.

---
 ell/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ell/log.c +1 -1
index e6682cf..6a2e86b 100644
@@ -214,7 +214,7 @@ static void log_journal(int priority, const char *file, const char *line,
 	iov[0].iov_base = "MESSAGE=";
 	iov[0].iov_len  = 8;
 	iov[1].iov_base = str;
-	iov[1].iov_len  = str_len - 1;
+	iov[1].iov_len  = str_len;
 	iov[2].iov_base = prio;
 	iov[2].iov_len  = prio_len;
 	iov[3].iov_base = "CODE_FILE=";
Signature · 1 line
2.7.4
#1 lore raw

Hi Ossama,

Quoted 9 lines · Ossama Othman

When logging messages to the systemd journal the trailing line feed character was truncated since the message length was incorrectly reduced by one. That resulted in the next systemd journal field, in this case PRIORITY, being written as part of the logged message string (e.g. "fooPRIORITY=6") rather than as a separate journal field.

---
 ell/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis