CT: outputting lager debug messages

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

CT: outputting lager debug messages

Bjarne Wichmann Bagge Petersen
I have a little issue where I would like to output lager debug-messages when running common tests. But I can't get it to work. 

In `init_pr_suite` I have 

application:load(lager),
application:set_env(lager, handlers, [{lager_console_backend, debug}, {lager_common_test_backend, debug}]),

And in the test-code I have this little snippet:

    ct:log("ENV ~p", [application:get_all_env(lager)]),
    lager:warning("Now you see me"),
    lager:debug("Now you don't"),

Which outputs:

*** User 2017-04-08 07:36:42.089 ***
ENV [{crash_log_count,5},
     {crash_log_date,"$D0"},
     {colored,false},
     {crash_log_msg_size,65536},
     {colors,[{debug,"\e[0;38m"},
              {info,"\e[1;37m"},
              {notice,"\e[1;36m"},
              {warning,"\e[1;33m"},
              {error,"\e[1;31m"},
              {critical,"\e[1;35m"},
              {alert,"\e[1;44m"},
              {emergency,"\e[1;41m"}]},
     {included_applications,[]},
     {async_threshold,20},
     {crash_log_size,10485760},
     {error_logger_whitelist,[cth_readable_failonly]},
     {error_logger_redirect,true},
     {async_threshold_window,5},
     {crash_log,"log/crash.log"},
     {error_logger_hwm,50},
     {handlers,[{lager_console_backend,debug},
                {lager_common_test_backend,debug}]}]

*** User 2017-04-08 07:36:42.090 ***
07:36:42.089 [warning] Now you see me


Missing the debug-line.

So what am I missing? Is `lager_common_test_backend` the wrong flag? Or is CT muting debug-messages anyway?


Best regards


Bjarne Wichmann Bagge Petersen

Backend Developer, ShopGun

A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark

ShopGun, your helping hand in shopping, is available at shopgun.com and as the ShopGun app.

This email is intended solely for the addressee and may contain confidential information and/or privileged confidential advice. If you receive this email by mistake, please do not read, print, transmit, store, or in any other way use the email or its attachments. Instead, please notify the addresser immediately and then permanently delete it. Thank you.

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

Re: CT: outputting lager debug messages

Luis Rascão-2
Maybe you're missing `lager:set_loglevel(lager_console_backend, debug).` ?

On Sat, Apr 8, 2017 at 6:48 AM, Bjarne Wichmann Bagge Petersen <[hidden email]> wrote:
I have a little issue where I would like to output lager debug-messages when running common tests. But I can't get it to work. 

In `init_pr_suite` I have 

application:load(lager),
application:set_env(lager, handlers, [{lager_console_backend, debug}, {lager_common_test_backend, debug}]),

And in the test-code I have this little snippet:

    ct:log("ENV ~p", [application:get_all_env(lager)]),
    lager:warning("Now you see me"),
    lager:debug("Now you don't"),

Which outputs:

*** User 2017-04-08 07:36:42.089 ***
ENV [{crash_log_count,5},
     {crash_log_date,"$D0"},
     {colored,false},
     {crash_log_msg_size,65536},
     {colors,[{debug,"\e[0;38m"},
              {info,"\e[1;37m"},
              {notice,"\e[1;36m"},
              {warning,"\e[1;33m"},
              {error,"\e[1;31m"},
              {critical,"\e[1;35m"},
              {alert,"\e[1;44m"},
              {emergency,"\e[1;41m"}]},
     {included_applications,[]},
     {async_threshold,20},
     {crash_log_size,10485760},
     {error_logger_whitelist,[cth_readable_failonly]},
     {error_logger_redirect,true},
     {async_threshold_window,5},
     {crash_log,"log/crash.log"},
     {error_logger_hwm,50},
     {handlers,[{lager_console_backend,debug},
                {lager_common_test_backend,debug}]}]

*** User 2017-04-08 07:36:42.090 ***
07:36:42.089 [warning] Now you see me


Missing the debug-line.

So what am I missing? Is `lager_common_test_backend` the wrong flag? Or is CT muting debug-messages anyway?


Best regards


Bjarne Wichmann Bagge Petersen

Backend Developer, ShopGun

A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark

ShopGun, your helping hand in shopping, is available at shopgun.com and as the ShopGun app.

This email is intended solely for the addressee and may contain confidential information and/or privileged confidential advice. If you receive this email by mistake, please do not read, print, transmit, store, or in any other way use the email or its attachments. Instead, please notify the addresser immediately and then permanently delete it. Thank you.

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




--
PGP fingerprint: F708 E141 AE8D 2D38 E1BC  DF3D 1719 3EA0 647D 7260

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

Re: CT: outputting lager debug messages

Alex S.
In reply to this post by Bjarne Wichmann Bagge Petersen
You’re, iirc, supposed to call lager_common_test_backend:bounce/1, otherwise I’m not sure how it works.
8 апр. 2017 г., в 8:48, Bjarne Wichmann Bagge Petersen <[hidden email]> написал(а):

I have a little issue where I would like to output lager debug-messages when running common tests. But I can't get it to work. 

In `init_pr_suite` I have 

application:load(lager),
application:set_env(lager, handlers, [{lager_console_backend, debug}, {lager_common_test_backend, debug}]),

And in the test-code I have this little snippet:

    ct:log("ENV ~p", [application:get_all_env(lager)]),
    lager:warning("Now you see me"),
    lager:debug("Now you don't"),

Which outputs:

*** User 2017-04-08 07:36:42.089 ***
ENV [{crash_log_count,5},
     {crash_log_date,"$D0"},
     {colored,false},
     {crash_log_msg_size,65536},
     {colors,[{debug,"\e[0;38m"},
              {info,"\e[1;37m"},
              {notice,"\e[1;36m"},
              {warning,"\e[1;33m"},
              {error,"\e[1;31m"},
              {critical,"\e[1;35m"},
              {alert,"\e[1;44m"},
              {emergency,"\e[1;41m"}]},
     {included_applications,[]},
     {async_threshold,20},
     {crash_log_size,10485760},
     {error_logger_whitelist,[cth_readable_failonly]},
     {error_logger_redirect,true},
     {async_threshold_window,5},
     {crash_log,"log/crash.log"},
     {error_logger_hwm,50},
     {handlers,[{lager_console_backend,debug},
                {lager_common_test_backend,debug}]}]

*** User 2017-04-08 07:36:42.090 ***
07:36:42.089 [warning] Now you see me


Missing the debug-line.

So what am I missing? Is `lager_common_test_backend` the wrong flag? Or is CT muting debug-messages anyway?


Best regards


Bjarne Wichmann Bagge Petersen

Backend Developer, ShopGun

A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark

ShopGun, your helping hand in shopping, is available at shopgun.com and as the ShopGun app.

This email is intended solely for the addressee and may contain confidential information and/or privileged confidential advice. If you receive this email by mistake, please do not read, print, transmit, store, or in any other way use the email or its attachments. Instead, please notify the addresser immediately and then permanently delete it. Thank you.
_______________________________________________
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
|  
Report Content as Inappropriate

Re: CT: outputting lager debug messages

Jacob-2
In reply to this post by Luis Rascão-2
I am using this code in my test suite modules to catch lager debug output:

init_per_suite(Cfg) ->
    lager_common_test_backend:bounce(debug),
    Cfg.

No other changes are required. The lager logging messages are then
included in the regular test suite output files.

Best regards

Jacob

On 04/12/2017 05:32 PM, Luis Rascão wrote:

> Maybe you're missing `lager:set_loglevel(lager_console_backend, debug).` ?
>
> On Sat, Apr 8, 2017 at 6:48 AM, Bjarne Wichmann Bagge Petersen
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I have a little issue where I would like to output lager
>     debug-messages when running common tests. But I can't get it to work.
>
>     In `init_pr_suite` I have
>
>     application:load(lager),
>     application:set_env(lager, handlers, [{lager_console_backend,
>     debug}, {lager_common_test_backend, debug}]),
>
>     And in the test-code I have this little snippet:
>
>         ct:log("ENV ~p", [application:get_all_env(lager)]),
>         lager:warning("Now you see me"),
>         lager:debug("Now you don't"),
>
>     Which outputs:
>
>     *** User 2017-04-08 07:36:42.089 ***
>     ENV [{crash_log_count,5},
>          {crash_log_date,"$D0"},
>          {colored,false},
>          {crash_log_msg_size,65536},
>          {colors,[{debug,"\e[0;38m"},
>                   {info,"\e[1;37m"},
>                   {notice,"\e[1;36m"},
>                   {warning,"\e[1;33m"},
>                   {error,"\e[1;31m"},
>                   {critical,"\e[1;35m"},
>                   {alert,"\e[1;44m"},
>                   {emergency,"\e[1;41m"}]},
>          {included_applications,[]},
>          {async_threshold,20},
>          {crash_log_size,10485760},
>          {error_logger_whitelist,[cth_readable_failonly]},
>          {error_logger_redirect,true},
>          {async_threshold_window,5},
>          {crash_log,"log/crash.log"},
>          {error_logger_hwm,50},
>          {handlers,[{lager_console_backend,debug},
>                     {lager_common_test_backend,debug}]}]
>
>     *** User 2017-04-08 07:36:42.090 ***
>     07:36:42.089 [warning] Now you see me
>
>
>     Missing the debug-line.
>
>     So what am I missing? Is `lager_common_test_backend` the wrong flag?
>     Or is CT muting debug-messages anyway?
>
>
>     Best regards
>
>
>     Bjarne Wichmann Bagge Petersen
>
>     Backend Developer, ShopGun
>
>
>     E: [hidden email] <mailto:[hidden email]>
>     L: dk.linkedin.com/in/bjarnewp <http://dk.linkedin.com/in/bjarnewp>
>     W: shopgun.com <http://shopgun.com>
>     A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S,
>     Denmark
>
>     ShopGun, your helping hand in shopping, is available at shopgun.com
>     <http://shopgun.com> and as the ShopGun app
>     <http://shopgun.com/app/download/>.
>
>     This email is intended solely for the addressee and may contain
>     confidential information and/or privileged confidential advice. If
>     you receive this email by mistake, please do not read, print,
>     transmit, store, or in any other way use the email or its
>     attachments. Instead, please notify the addresser immediately and
>     then permanently delete it. Thank you.
>
>     _______________________________________________
>     erlang-questions mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://erlang.org/mailman/listinfo/erlang-questions
>     <http://erlang.org/mailman/listinfo/erlang-questions>
>
>
>
>
> --
> PGP fingerprint: F708 E141 AE8D 2D38 E1BC  DF3D 1719 3EA0 647D 7260
>
>
> _______________________________________________
> 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
|  
Report Content as Inappropriate

Re: CT: outputting lager debug messages

Bjarne Wichmann Bagge Petersen
Great, thanks.

init_per_suite(Cfg) ->
    lager_common_test_backend:bounce(debug),
    Cfg.

did the trick, now I am getting debug messages in tests. :-)


Best regards


Bjarne Wichmann Bagge Petersen

Backend Developer, ShopGun

A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark

2017-04-12 17:42 GMT+02:00 Jacob <[hidden email]>:
I am using this code in my test suite modules to catch lager debug output:

init_per_suite(Cfg) ->
    lager_common_test_backend:bounce(debug),
    Cfg.

No other changes are required. The lager logging messages are then
included in the regular test suite output files.

Best regards

Jacob

On 04/12/2017 05:32 PM, Luis Rascão wrote:
> Maybe you're missing `lager:set_loglevel(lager_console_backend, debug).` ?
>
> On Sat, Apr 8, 2017 at 6:48 AM, Bjarne Wichmann Bagge Petersen
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I have a little issue where I would like to output lager
>     debug-messages when running common tests. But I can't get it to work.
>
>     In `init_pr_suite` I have
>
>     application:load(lager),
>     application:set_env(lager, handlers, [{lager_console_backend,
>     debug}, {lager_common_test_backend, debug}]),
>
>     And in the test-code I have this little snippet:
>
>         ct:log("ENV ~p", [application:get_all_env(lager)]),
>         lager:warning("Now you see me"),
>         lager:debug("Now you don't"),
>
>     Which outputs:
>
>     *** User 2017-04-08 07:36:42.089 ***
>     ENV [{crash_log_count,5},
>          {crash_log_date,"$D0"},
>          {colored,false},
>          {crash_log_msg_size,65536},
>          {colors,[{debug,"\e[0;38m"},
>                   {info,"\e[1;37m"},
>                   {notice,"\e[1;36m"},
>                   {warning,"\e[1;33m"},
>                   {error,"\e[1;31m"},
>                   {critical,"\e[1;35m"},
>                   {alert,"\e[1;44m"},
>                   {emergency,"\e[1;41m"}]},
>          {included_applications,[]},
>          {async_threshold,20},
>          {crash_log_size,10485760},
>          {error_logger_whitelist,[cth_readable_failonly]},
>          {error_logger_redirect,true},
>          {async_threshold_window,5},
>          {crash_log,"log/crash.log"},
>          {error_logger_hwm,50},
>          {handlers,[{lager_console_backend,debug},
>                     {lager_common_test_backend,debug}]}]
>
>     *** User 2017-04-08 07:36:42.090 ***
>     07:36:42.089 [warning] Now you see me
>
>
>     Missing the debug-line.
>
>     So what am I missing? Is `lager_common_test_backend` the wrong flag?
>     Or is CT muting debug-messages anyway?
>
>
>     Best regards
>
>
>     Bjarne Wichmann Bagge Petersen
>
>     Backend Developer, ShopGun
>
>
>     E: [hidden email] <mailto:[hidden email]>
>     L: dk.linkedin.com/in/bjarnewp <http://dk.linkedin.com/in/bjarnewp>
>     W: shopgun.com <http://shopgun.com>
>     A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S,
>     Denmark
>
>     ShopGun, your helping hand in shopping, is available at shopgun.com
>     <http://shopgun.com> and as the ShopGun app
>     <http://shopgun.com/app/download/>.
>
>     This email is intended solely for the addressee and may contain
>     confidential information and/or privileged confidential advice. If
>     you receive this email by mistake, please do not read, print,
>     transmit, store, or in any other way use the email or its
>     attachments. Instead, please notify the addresser immediately and
>     then permanently delete it. Thank you.
>
>     _______________________________________________
>     erlang-questions mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://erlang.org/mailman/listinfo/erlang-questions
>     <http://erlang.org/mailman/listinfo/erlang-questions>
>
>
>
>
> --
> PGP fingerprint: F708 E141 AE8D 2D38 E1BC  DF3D 1719 3EA0 647D 7260
>
>
> _______________________________________________
> 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


ShopGun, your helping hand in shopping, is available at shopgun.com and as the ShopGun app.

This email is intended solely for the addressee and may contain confidential information and/or privileged confidential advice. If you receive this email by mistake, please do not read, print, transmit, store, or in any other way use the email or its attachments. Instead, please notify the addresser immediately and then permanently delete it. Thank you.

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

Re: CT: outputting lager debug messages

Bjarne Wichmann Bagge Petersen
I was too quick to celebrate. 

There is a side effect to

lager_common_test_backend:bounce(debug)

in that i mutes non-lager error messages from the CT logs (html), though I do see them in the console now.

Best regards


Bjarne Wichmann Bagge Petersen

Backend Developer, ShopGun

A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark

2017-04-18 15:07 GMT+02:00 Bjarne Wichmann Bagge Petersen <[hidden email]>:
Great, thanks.

init_per_suite(Cfg) ->
    lager_common_test_backend:bounce(debug),
    Cfg.

did the trick, now I am getting debug messages in tests. :-)


Best regards


Bjarne Wichmann Bagge Petersen

Backend Developer, ShopGun

A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark

2017-04-12 17:42 GMT+02:00 Jacob <[hidden email]>:
I am using this code in my test suite modules to catch lager debug output:

init_per_suite(Cfg) ->
    lager_common_test_backend:bounce(debug),
    Cfg.

No other changes are required. The lager logging messages are then
included in the regular test suite output files.

Best regards

Jacob

On 04/12/2017 05:32 PM, Luis Rascão wrote:
> Maybe you're missing `lager:set_loglevel(lager_console_backend, debug).` ?
>
> On Sat, Apr 8, 2017 at 6:48 AM, Bjarne Wichmann Bagge Petersen
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     I have a little issue where I would like to output lager
>     debug-messages when running common tests. But I can't get it to work.
>
>     In `init_pr_suite` I have
>
>     application:load(lager),
>     application:set_env(lager, handlers, [{lager_console_backend,
>     debug}, {lager_common_test_backend, debug}]),
>
>     And in the test-code I have this little snippet:
>
>         ct:log("ENV ~p", [application:get_all_env(lager)]),
>         lager:warning("Now you see me"),
>         lager:debug("Now you don't"),
>
>     Which outputs:
>
>     *** User 2017-04-08 07:36:42.089 ***
>     ENV [{crash_log_count,5},
>          {crash_log_date,"$D0"},
>          {colored,false},
>          {crash_log_msg_size,65536},
>          {colors,[{debug,"\e[0;38m"},
>                   {info,"\e[1;37m"},
>                   {notice,"\e[1;36m"},
>                   {warning,"\e[1;33m"},
>                   {error,"\e[1;31m"},
>                   {critical,"\e[1;35m"},
>                   {alert,"\e[1;44m"},
>                   {emergency,"\e[1;41m"}]},
>          {included_applications,[]},
>          {async_threshold,20},
>          {crash_log_size,10485760},
>          {error_logger_whitelist,[cth_readable_failonly]},
>          {error_logger_redirect,true},
>          {async_threshold_window,5},
>          {crash_log,"log/crash.log"},
>          {error_logger_hwm,50},
>          {handlers,[{lager_console_backend,debug},
>                     {lager_common_test_backend,debug}]}]
>
>     *** User 2017-04-08 07:36:42.090 ***
>     07:36:42.089 [warning] Now you see me
>
>
>     Missing the debug-line.
>
>     So what am I missing? Is `lager_common_test_backend` the wrong flag?
>     Or is CT muting debug-messages anyway?
>
>
>     Best regards
>
>
>     Bjarne Wichmann Bagge Petersen
>
>     Backend Developer, ShopGun
>
>
>     E: [hidden email] <mailto:[hidden email]>
>     L: dk.linkedin.com/in/bjarnewp <http://dk.linkedin.com/in/bjarnewp>
>     W: shopgun.com <http://shopgun.com>
>     A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S,
>     Denmark
>
>     ShopGun, your helping hand in shopping, is available at shopgun.com
>     <http://shopgun.com> and as the ShopGun app
>     <http://shopgun.com/app/download/>.
>
>     This email is intended solely for the addressee and may contain
>     confidential information and/or privileged confidential advice. If
>     you receive this email by mistake, please do not read, print,
>     transmit, store, or in any other way use the email or its
>     attachments. Instead, please notify the addresser immediately and
>     then permanently delete it. Thank you.
>
>     _______________________________________________
>     erlang-questions mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://erlang.org/mailman/listinfo/erlang-questions
>     <http://erlang.org/mailman/listinfo/erlang-questions>
>
>
>
>
> --
> PGP fingerprint: F708 E141 AE8D 2D38 E1BC  DF3D 1719 3EA0 647D 7260
>
>
> _______________________________________________
> 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



ShopGun, your helping hand in shopping, is available at shopgun.com and as the ShopGun app.

This email is intended solely for the addressee and may contain confidential information and/or privileged confidential advice. If you receive this email by mistake, please do not read, print, transmit, store, or in any other way use the email or its attachments. Instead, please notify the addresser immediately and then permanently delete it. Thank you.

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