Closed cgskumar77 closed 2 years ago
You should check the type of the severity level attribute in your logger lg
. You're specifying int
in the severity mapping function (direct_severity_mapping< int >
), so if the severity attribute value has a different type the mapping function won't be able to extract it from the log record and will return the default value, which is info
.
Thank you very much, Andrey. The following change helped:
- src::logger lg;
+ src::severity_logger<int> lg { keywords::severity = sinks::syslog::error };
I should have read https://www.boost.org/doc/libs/1_79_0/libs/log/doc/html/log/detailed/sources.html#log.detailed.sources.severity_level_logger
Thanks, Senthil.
Hi,
My rsyslog is unable to apply selectors to the priority portion of the logs sent by boost.log.
I'm using boost_1_79 with native syslog on Ubuntu 18.04.
I'm following instructions from https://www.boost.org/doc/libs/1_79_0/libs/log/doc/html/log/detailed/sink_backends.html#log.detailed.sink_backends.syslog
Here is the code snippet:
Here is my /etc/rsyslog.d/50-default.conf:
user.alert -/var/log/user.log
This doesn't write a record in user.log file unless I change the selector to
user.*
. I have also tried to explicitly define a custom mapping as well with the same results.However, I don't have any such problems if I use the
logger
utility from the command line to write logs. This suggests that the logs from boost.log doesn't have the right severity in them. Is that possible? Or I have something wrong in my code although it is just cut and paste from the tutorial mentioned above.Any ideas on how to resolve this?
Thanks, Senthil.