[erlang-questions] no logger output using ?LOG macros in release

Mark Geib mark.geib.44@REDACTED
Mon Mar 25 20:49:03 CET 2019


Yes, here is the bottom of my sys.config.

{kernel,
    [{logger_level, info}, {logger,
      [{handler, default, logger_disk_log_h,
       #{config => #{file => "/var/log/asp2aj/erlang.log", type => wrap, max_no_files => 10, max_no_bytes => 1000000000},
         formatter => {logger_formatter, #{single_line => true, template => [time," ",mfa,":",line," ",pid," [",level,"] ",msg,"\n"]}}}
      }]
    }]
  }].

Mark.


> On Mar 25, 2019, at 1:44 PM, Steve Strong <steve@REDACTED> wrote:
> 
> Do you have the logger_level value set in your sys.config (or are you setting it in code)?  The ?LOG macros check that before logging…
> 
> -define(DO_LOG(Level,Args),
>         case logger:allow(Level,?MODULE) of
>             true ->
>                 apply(logger,macro_log,[?LOCATION,Level|Args]);
>             false ->
>                 ok
>         end).
> -endif.
> 
> Cheers,
> 
> Steve
> 
>> On 25 Mar 2019, at 19:41, Mark Geib <mark.geib.44@REDACTED <mailto:mark.geib.44@REDACTED>> wrote:
>> 
>> I am using the default handler and formatter, i.e.: 
>> 
>> [{handler, default, logger_disk_log_h,  % handler, HandlerId, Module,
>>   #{config => #{file => "/var/log/asp2aj/erlang.log", type => wrap, max_no_files => 10, max_no_bytes => 1000000000},
>>     formatter => {logger_formatter, #{single_line => true, template => [time," ",mfa,":",line," ",pid," [",level,"] ",msg,"\n"]}}}
>>  }]
>> 
>> 
>> And my logging works fine previously when I was doing logger:info()...
>> 
>> Thanks,
>> Mark.
>> 
>> 
>>> On Mar 25, 2019, at 1:32 PM, Fred Hebert <mononcqc@REDACTED <mailto:mononcqc@REDACTED>> wrote:
>>> 
>>> See if you are using any log formatters or handlers -- those may not be direct dependencies of your application, and therefore do not get included in the final release. You will need to add these dependencies to the release independently so that they are present to run and handle output.
>>> 
>>> The rebar3 shell and other interactive modes can dynamically load libraries from disk and won't show that little gotcha at all.
>>> 
>>> On Mon, Mar 25, 2019 at 1:47 PM Mark Geib <mark.geib.44@REDACTED <mailto:mark.geib.44@REDACTED>> wrote:
>>> I have a problem where I see no logger output in a release built with rebar3 using the new ?LOG macros. If I use the logger: functions
>>> everything is working fine. Decided to change to use the macros in order to get able to include MFA, line number, etc. in templates.
>>> 
>>> Also, doing a dev release build and then running interactively everything works fine with the ?LOG macros. It’s like the
>>> prod builds are missing something compared to dev build.
>>> 
>>> Thanks in advance for any help.
>>> 
>>> Mark.
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>>> http://erlang.org/mailman/listinfo/erlang-questions <http://erlang.org/mailman/listinfo/erlang-questions>
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>> http://erlang.org/mailman/listinfo/erlang-questions
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190325/7bb9fffb/attachment.htm>


More information about the erlang-questions mailing list