Project

General

Profile

Feature #3509

Add log level to log message

Added by Harald Dunkel 4 months ago. Updated 3 days ago.

Status:
Closed
Priority:
Normal
Category:
libcharon
Target version:
Start date:
09.07.2020
Due date:
Estimated time:
Resolution:
Fixed

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.

Associated revisions

Revision a3f5e38b (diff)
Added by Tobias Brunner 3 days ago

file-logger: Optionally log the level of each message

Fixes #3509.

Revision b422f16d (diff)
Added by Tobias Brunner 3 days ago

sys-logger: Optionally log the level of each message

Fixes #3509.

History

#1 Updated by Tobias Brunner 3 months 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 3 months 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 3 months 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 3 months ago

  • Target version set to 5.9.1

#5 Updated by Tobias Brunner 3 days ago

  • Status changed from Feedback to Closed
  • Assignee set to Tobias Brunner
  • Resolution set to Fixed

Also available in: Atom PDF