<div dir="ltr">The local process always emits all logs generated by phosphor-logging, it is up to the journald configuration what levels are used for different things.<div><a href="https://www.freedesktop.org/software/systemd/man/journald.conf.html">https://www.freedesktop.org/software/systemd/man/journald.conf.html</a><br></div><div><br></div><div>You can change the priority level output by journalctl on the command line too, to filter out lower priority messages.</div><div>`journal -p err` or some other level</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 3, 2020 at 12:18 PM Johnathan Mantey <<a href="mailto:johnathanx.mantey@intel.com">johnathanx.mantey@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
I would like it to be easier to determine how to change the error
message level.<br>
I don't bother with the log code because I don't know where it's
controlled.<br>
<br>
<div>On 6/3/20 12:02 PM, Vijay Khemka wrote:<br>
</div>
<blockquote type="cite">
<pre>On 6/2/20, 5:08 PM, "openbmc on behalf of Vernon Mauery" <a href="mailto:openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.orgonbehalfofvernon.mauery@linux.intel.com" target="_blank"><openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org on behalf of vernon.mauery@linux.intel.com></a> wrote:
On 02-Jun-2020 06:06 PM, Patrick Williams wrote:
>On Mon, Jun 01, 2020 at 11:07:46PM -0700, William Kennington wrote:
>> If you use the fmt library it would only require one extra temporary string
>> to be constructed and it works trivially with something like phosphor
>> logging.
>>
>> log<level::INFO>(fmt::format("My error: {}", filename));
>>
>> It also has the advantage of understanding basic c++ types like
>> std::strings and std::string_views.
>>
>> On Mon, Jun 1, 2020 at 8:33 PM 郁雷 <a href="mailto:yulei.sh@bytedance.com" target="_blank"><yulei.sh@bytedance.com></a> wrote:
>>
>> > I have a bit concern about this. The existing phosphor-logging API
>> > does not support this well.
>> > Specifically, it does not support the "printf" way to generate a
>> > string with the variables to log.
>> > So previously we typically put the variables in entries.
>> > I do agree that logging the variables in the MESSAGE field is much better.
>> > But to encourage such logging, the logging API should be enhanced to
>> > support the "printf" way.
>> > E.g.
>> > log<level::INFO>("Something is wrong: %s:%d", xx, xxx);
>> > is much better than:
>> > std::string to_log = xxx; // generate the message manually
>> > log<level::INFO>(to_log);
>> >
>> > Otherwise, it's really not convenient to write such logging code.
>> >
>
>Separate from this proposal from Brad, I'd like to work on a
>next-generation of phosphor-logging. When we originally implemented
>phosphor-logging we were all pretty new to C++14. I think there can be
>some great improvement in the syntax of phosphor-logging now that we
>have C++17 (and more experience).
>
>The biggest change I'd like to do is in the way the structured entries
>are defined, but I think we can improve the verbosity of syntax in
>making a log in general.
One more change I would like to see is a way to actually have the real
filename and line number show up in the systemd log. Right now the
filename and line number are always the logger code:
CODE_LINE=76
CODE_FUNC=helper_log
CODE_FILE=.../usr/include/phosphor-logging/log.hpp
It will be good if we can have debug as a level and somehow we can see
messages from debug by enabling or disabling.
It looks like C++20 has a shiny new helper for this: source_location
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__en.cppreference.com_w_cpp_experimental_source-5Flocation&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=v9MU0Ki9pWnTXCWwjHPVgpnCR80vXkkcrIaqU7USl5g&m=qFbu7FdFQSHVMy4ZvMtHDH5RzYQnqMUQ_T0h4qL0Xd0&s=QRsbQvb4LKAEoa8AITFyPFhcoCSVHtFLMOU66UodPnM&e=" target="_blank">https://urldefense.proofpoint.com/v2/url?u=https-3A__en.cppreference.com_w_cpp_experimental_source-5Flocation&d=DwIFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=v9MU0Ki9pWnTXCWwjHPVgpnCR80vXkkcrIaqU7USl5g&m=qFbu7FdFQSHVMy4ZvMtHDH5RzYQnqMUQ_T0h4qL0Xd0&s=QRsbQvb4LKAEoa8AITFyPFhcoCSVHtFLMOU66UodPnM&e=</a>
--Vernon
>Some example syntax:
>
>// Current syntax (and I'm being especially verbose on the namespaces).
>phosphor::logging::log<phosphor::logging::level::ERR>("Some message",
> phosphor::logging::entry("EXAMPLE=%s"), example_str);
>
>// Potential syntax
>lg::error("Some message", "EXAMPLE"_s, example_str);
>
>In a code-review I was on, we had some discussions about how difficult
>it is to create data that isn't in the "-o verbose" and I think William
>and Lei are both referring to that as well. I am concerned that a
>generic format leads us more to unstructured logging, which personally I
>don't like. My suggestion is that we have some easy syntax to indicate
>"also put this structured data into the raw message" so that my example
>above the message becomes "Some message. EXAMPLE='the string'".
>
>I'd be interested to hear what "next generation logging" others have in
>mind.
>
>--
>Patrick Williams
</pre>
</blockquote>
<br>
<div>-- <br>
<font color="#1F497D"><font face="Century Gothic">Johnathan Mantey<br>
<small>Senior Software Engineer</small><br>
<big><font color="#555555"><small><b>azad te</b><b>chnology
partners</b></small><br>
<small><font color="#1F497D"><small>Contributing to
Technology Innovation since 1992</small></font><small><br>
<font color="#1F497D">Phone: <a href="tel:(503)%20712-6764" value="+15037126764" target="_blank">(503) 712-6764</a><br>
Email: <a href="mailto:johnathanx.mantey@intel.com" target="_blank">johnathanx.mantey@intel.com</a></font></small><br>
<br>
</small></font></big></font></font> </div>
</div>
</blockquote></div>