[erlang-questions] CT: outputting lager debug messages

Bjarne Wichmann Bagge Petersen <>
Tue Apr 18 15:07:15 CEST 2017


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


E: 
L: dk.linkedin.com/in/bjarnewp
W: shopgun.com
A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark

2017-04-12 17:42 GMT+02:00 Jacob <>:

> 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
> > < <mailto:>> 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:  <mailto:>
> >     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
> >      <mailto:>
> >     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
> > 
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
ShopGun, your helping hand in shopping, is available at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170418/f1f30a0f/attachment.html>


More information about the erlang-questions mailing list