Project

General

Profile

Feature #3509

Add log level to log message

Added by Harald Dunkel about 1 month ago. Updated 20 days ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Category:
libcharon
Target version:
Start date:
09.07.2020
Due date:
Estimated time:
Resolution:

Description

I understand that it might be pretty painful to change the log file format, but do you think it would be possible to show the logging level of each output line in the log files? It could say "[IKE=3]" instead of "[IKE]" (for example), if a message is shown only for logging level 3 or higher. This could help to find the right logging level for each category to fine-tune the charon-logging.conf. If you don't want to see the messages with "IKE = 3" or higher anymore, then you can set "IKE = 2" in the config gile. Without this information you have to guess.

openssh does something similar in verbose mode, e.g. for "ssh -v -v -v" it shows "debug3", "debug2" or "debug1" for the appropriate lines in the verbose output. Very useful.

History

#1 Updated by Tobias Brunner 23 days ago

  • Subject changed from tiny log format change? to Add log level to log message
  • Category set to libcharon
  • Status changed from New to Feedback

If you use charon-systemd with its journal-logger you already have that information available (LEVEL is the field storing the log level, plus they are mapped to priorities in the PRIORITY field, see logging).

For file- and syslog-loggers I had a patch for this somewhere (I think it added an option and the format was [<group><level>] e.g. [IKE3]). I'd have to look on my other system to check if it is still around somewhere.

#2 Updated by Tobias Brunner 22 days ago

For file- and syslog-loggers I had a patch for this somewhere (I think it added an option and the format was [<group><level>] e.g. [IKE3]). I'd have to look on my other system to check if it is still around somewhere.

I wasn't able to locate that patch, but I quickly put something together in the 3509-log-level branch.

#3 Updated by Harald Dunkel 21 days ago

I have applied the patch on top of 5.8.4 to a gateway in the office: Works very well.

#4 Updated by Tobias Brunner 20 days ago

  • Target version set to 5.9.1

Also available in: Atom PDF