r21 logger difficulties

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

r21 logger difficulties

Mark Geib-2
I decided to take a look at the new logger in R21, but I am not able to produce any output.

In my sys.config I have the following:
{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
    }]
 }

And in my code I do something like logger:info(“test message”), but I never see any output to the file. I see the file log/erlang.log created, but always empty.

I must be missing something, but I have read through the docs, quickly.

Any pointers would be appreciated.

Mark.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

signature.asc (540 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: r21 logger difficulties

Siri Hansen
Hi Mark, you just missed that the primary log level by default is 'notice', which means that 'info' is rejected by the primary log level check. If you do logger:notice("test message") instead, it should be printed. To even print 'info', set the kernel configuration parameter logger_level to 'info', 'debug' or 'all' in your sys config, or set it in runtime with logger:set_primary_config(level,Level).

Regards
/siri

Den fre. 6. jul. 2018 kl. 20:44 skrev Mark Geib <[hidden email]>:
I decided to take a look at the new logger in R21, but I am not able to produce any output.

In my sys.config I have the following:
{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
    }]
 }

And in my code I do something like logger:info(“test message”), but I never see any output to the file. I see the file log/erlang.log created, but always empty.

I must be missing something, but I have read through the docs, quickly.

Any pointers would be appreciated.

Mark.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: r21 logger difficulties

Mark Geib-2
Thanks Siri,

But in my sys.config I included the log level, and I was trying to set it to “debug”.

I just now changed the level to “all” but still nothing in the log file.

BTW, if I force a crash due to runtime error I do see the crash reports in the log file, but that is all.

Also, lager is being pulled in by a dependency, could there be a conflict with lager.??

Thanks,

Mark.



On Jul 9, 2018, at 1:33 AM, Siri Hansen <[hidden email]> wrote:

Hi Mark, you just missed that the primary log level by default is 'notice', which means that 'info' is rejected by the primary log level check. If you do logger:notice("test message") instead, it should be printed. To even print 'info', set the kernel configuration parameter logger_level to 'info', 'debug' or 'all' in your sys config, or set it in runtime with logger:set_primary_config(level,Level).

Regards
/siri

Den fre. 6. jul. 2018 kl. 20:44 skrev Mark Geib <[hidden email]>:
I decided to take a look at the new logger in R21, but I am not able to produce any output.

In my sys.config I have the following:
{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
    }]
 }

And in my code I do something like logger:info(“test message”), but I never see any output to the file. I see the file log/erlang.log created, but always empty.

I must be missing something, but I have read through the docs, quickly.

Any pointers would be appreciated.

Mark.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

signature.asc (540 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: r21 logger difficulties

Mark Geib-2
In reply to this post by Siri Hansen
So after some more debugging, it appears that if I use “debug” or “info” in either the sys.config logger config for the logging level, or as the level of log message I see nothing. If I use any of the other levels it appears to work as expected. All the combinations I tried worked as well, i.e. if I set the log level in the config to “notice” and then log with logger:emergency(), it works fine.

Mark.

On Jul 9, 2018, at 1:33 AM, Siri Hansen <[hidden email]> wrote:

Hi Mark, you just missed that the primary log level by default is 'notice', which means that 'info' is rejected by the primary log level check. If you do logger:notice("test message") instead, it should be printed. To even print 'info', set the kernel configuration parameter logger_level to 'info', 'debug' or 'all' in your sys config, or set it in runtime with logger:set_primary_config(level,Level).

Regards
/siri

Den fre. 6. jul. 2018 kl. 20:44 skrev Mark Geib <[hidden email]>:
I decided to take a look at the new logger in R21, but I am not able to produce any output.

In my sys.config I have the following:
{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
    }]
 }

And in my code I do something like logger:info(“test message”), but I never see any output to the file. I see the file log/erlang.log created, but always empty.

I must be missing something, but I have read through the docs, quickly.

Any pointers would be appreciated.

Mark.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

signature.asc (540 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: r21 logger difficulties

Siri Hansen
Hi again, Mark!

I see that you set the handler level to debug in the sys.config, but I can't see that the primary level is set? Please refer to the Kernel User's Guide, http://erlang.org/doc/apps/kernel/logger_chapter.html, for a description of how primary level check and -filters are applied prior to all handler level checks and -filters. (short version: if a log event does not pass the primary level check, it is discarded and will never hit any handler).

Primary level is 'notice' by default, and handler levels are 'all' by default.

What I mean is that your sys.config should look something like this:

{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
     },
     {logger_level, all}
    ]
}

Den man. 9. jul. 2018 kl. 19:22 skrev Mark Geib <[hidden email]>:
So after some more debugging, it appears that if I use “debug” or “info” in either the sys.config logger config for the logging level, or as the level of log message I see nothing. If I use any of the other levels it appears to work as expected. All the combinations I tried worked as well, i.e. if I set the log level in the config to “notice” and then log with logger:emergency(), it works fine.

Mark.

On Jul 9, 2018, at 1:33 AM, Siri Hansen <[hidden email]> wrote:

Hi Mark, you just missed that the primary log level by default is 'notice', which means that 'info' is rejected by the primary log level check. If you do logger:notice("test message") instead, it should be printed. To even print 'info', set the kernel configuration parameter logger_level to 'info', 'debug' or 'all' in your sys config, or set it in runtime with logger:set_primary_config(level,Level).

Regards
/siri

Den fre. 6. jul. 2018 kl. 20:44 skrev Mark Geib <[hidden email]>:
I decided to take a look at the new logger in R21, but I am not able to produce any output.

In my sys.config I have the following:
{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
    }]
 }

And in my code I do something like logger:info(“test message”), but I never see any output to the file. I see the file log/erlang.log created, but always empty.

I must be missing something, but I have read through the docs, quickly.

Any pointers would be appreciated.

Mark.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: r21 logger difficulties

Siri Hansen
Sorry, there's a bug in OTP-21.0 which does not allow the value 'all' for 'logger_level', so you need to specify 'debug' instead:

{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
     },
     {logger_level, debug}
    ]
}


Den ons. 11. jul. 2018 kl. 11:25 skrev Siri Hansen <[hidden email]>:
Hi again, Mark!

I see that you set the handler level to debug in the sys.config, but I can't see that the primary level is set? Please refer to the Kernel User's Guide, http://erlang.org/doc/apps/kernel/logger_chapter.html, for a description of how primary level check and -filters are applied prior to all handler level checks and -filters. (short version: if a log event does not pass the primary level check, it is discarded and will never hit any handler).

Primary level is 'notice' by default, and handler levels are 'all' by default.

What I mean is that your sys.config should look something like this:

{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
     },
     {logger_level, all}
    ]
}

Den man. 9. jul. 2018 kl. 19:22 skrev Mark Geib <[hidden email]>:
So after some more debugging, it appears that if I use “debug” or “info” in either the sys.config logger config for the logging level, or as the level of log message I see nothing. If I use any of the other levels it appears to work as expected. All the combinations I tried worked as well, i.e. if I set the log level in the config to “notice” and then log with logger:emergency(), it works fine.

Mark.

On Jul 9, 2018, at 1:33 AM, Siri Hansen <[hidden email]> wrote:

Hi Mark, you just missed that the primary log level by default is 'notice', which means that 'info' is rejected by the primary log level check. If you do logger:notice("test message") instead, it should be printed. To even print 'info', set the kernel configuration parameter logger_level to 'info', 'debug' or 'all' in your sys config, or set it in runtime with logger:set_primary_config(level,Level).

Regards
/siri

Den fre. 6. jul. 2018 kl. 20:44 skrev Mark Geib <[hidden email]>:
I decided to take a look at the new logger in R21, but I am not able to produce any output.

In my sys.config I have the following:
{kernel,
    [{logger,
      [{handler, default, logger_std_h,
       #{level => debug,
         config => #{type => {file,"log/erlang.log"}},
         formatter => {logger_formatter, #{template => [time," ",pid," ",msg,"\n"]}}}
      }]
    }]
 }

And in my code I do something like logger:info(“test message”), but I never see any output to the file. I see the file log/erlang.log created, but always empty.

I must be missing something, but I have read through the docs, quickly.

Any pointers would be appreciated.

Mark.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions