<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Just to follow up. <div class=""><br class=""></div><div class="">Spent yesterday tracking this all down and there is no issue with the logging macros, etc.<div class="">I was not explicitly specifying versions in my rebar.conf and late last week, while I was migrating my </div><div class="">logging to use the macros a new RC release of a dependency was pushed to the HEX repo. This is apparently </div><div class="">when my logging stopped working. Because I do my prod builds with an erlang docker image it was always</div><div class="">grabbing the latest release of all the dependencies, thus getting this new RC release. In dev of course</div><div class="">rebar3 locks the versions used in builds. I also failed to include the rebar.lock file in my repo.</div><div class=""><br class=""></div><div class="">Lesson learned, always use explicit versions of dependencies, and in addition add the rebar.lock to the repo.</div><div class=""><br class=""></div><div class="">Sorry for all the confusion and misleading information.</div><div class=""><br class=""></div><div class="">Mark.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 26, 2019, at 4:51 AM, Siri Hansen <<a href="mailto:erlangsiri@gmail.com" class="">erlangsiri@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Mark,<div class=""><br class=""></div><div class="">I'm not sure what the difference could be between dev an prod here, but if you can access your node, did you check that the logger configuration is as expected? logger:i() in OTP-21.3, or else logger:get_config(). Just to make sure nothing failed silently during startup. <br class=""></div><div class=""><br class=""></div><div class="">Another thing though - are you using run_erl with your prod release? If so, given the file name specified for the default handler, you must make sure that run_erl does not have the same log directory as you handler, or else they will attempt writing to the same file. logger_disk_log_h has no mechanism to ensure that it's file descriptor is fresh (the inode has not been changed), so if run_erl writes something to the same file, then the next log event from logger_disk_log_h will just disappear :(  (logger_std_h has better protection against this, and from OTP-21.3 it also has log rotation.) But this is of course not related to the macros at all, so if everything works ok with logger:info(..) but not with the macro, then there must be something else going on anyway.</div><div class=""><br class=""></div><div class="">Regards</div><div class="">/siri</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den man. 25. mar. 2019 kl. 20:49 skrev Mark Geib <<a href="mailto:mark.geib.44@gmail.com" class="">mark.geib.44@gmail.com</a>>:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class="">Yes, here is the bottom of my sys.config.<div class=""><br class=""></div><div class=""><div style="background-color:rgb(255,255,255);font-family:Menlo,Monaco,"Courier New",monospace;line-height:18px;white-space:pre-wrap" class=""><div class="">{kernel,</div><div class="">    [{logger_level, info}, {logger,</div><div class="">      [{handler, default, logger_disk_log_h,</div><div class="">       #{config => #{file => "/var/log/asp2aj/erlang.log", type => wrap, max_no_files => 10, max_no_bytes => 1000000000},</div><div class="">         formatter => {logger_formatter, #{single_line => true, template => [time," ",mfa,":",line," ",pid," [",level,"] ",msg,"\n"]}}}</div><div class="">      }]</div><div class="">    }]</div><div class="">  }].</div></div></div><div class=""><br class=""></div><div class="">Mark.</div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Mar 25, 2019, at 1:44 PM, Steve Strong <<a href="mailto:steve@srstrong.com" target="_blank" class="">steve@srstrong.com</a>> wrote:</div><br class="gmail-m_-5411505577597807348Apple-interchange-newline"><div class=""><div style="overflow-wrap: break-word;" class="">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…<div class=""><br class=""></div><div class=""><div class="">-define(DO_LOG(Level,Args),</div><div class="">        case logger:allow(Level,?MODULE) of</div><div class="">            true -></div><div class="">                apply(logger,macro_log,[?LOCATION,Level|Args]);</div><div class="">            false -></div><div class="">                ok</div><div class="">        end).</div><div class="">-endif.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">Steve</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 25 Mar 2019, at 19:41, Mark Geib <<a href="mailto:mark.geib.44@gmail.com" target="_blank" class="">mark.geib.44@gmail.com</a>> wrote:</div><br class="gmail-m_-5411505577597807348Apple-interchange-newline"><div class=""><div style="overflow-wrap: break-word;" class="">I am using the default handler and formatter, i.e.: <div class=""><br class=""></div><div class=""><div style="background-color:rgb(255,255,255);font-family:Menlo,Monaco,"Courier New",monospace;line-height:18px;white-space:pre-wrap" class=""><div class="">[{handler, default, logger_disk_log_h,  % handler, HandlerId, Module,</div><div class="">  #{config => #{file => "/var/log/asp2aj/erlang.log", type => wrap, max_no_files => 10, max_no_bytes => 1000000000},</div><div class="">    formatter => {logger_formatter, #{single_line => true, template => [time," ",mfa,":",line," ",pid," [",level,"] ",msg,"\n"]}}}</div><div class=""> }]</div><div class=""></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">And my logging works fine previously when I was doing logger:info()...</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Mark.</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Mar 25, 2019, at 1:32 PM, Fred Hebert <<a href="mailto:mononcqc@ferd.ca" target="_blank" class="">mononcqc@ferd.ca</a>> wrote:</div><br class="gmail-m_-5411505577597807348Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">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.</div><div class=""><br class=""></div><div class="">The rebar3 shell and other interactive modes can dynamically load libraries from disk and won't show that little gotcha at all.<br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 25, 2019 at 1:47 PM Mark Geib <<a href="mailto:mark.geib.44@gmail.com" target="_blank" class="">mark.geib.44@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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<br class="">
everything is working fine. Decided to change to use the macros in order to get able to include MFA, line number, etc. in templates.<br class="">
<br class="">
Also, doing a dev release build and then running interactively everything works fine with the ?LOG macros. It’s like the<br class="">
prod builds are missing something compared to dev build.<br class="">
<br class="">
Thanks in advance for any help.<br class="">
<br class="">
Mark.<br class="">
_______________________________________________<br class="">
erlang-questions mailing list<br class="">
<a href="mailto:erlang-questions@erlang.org" target="_blank" class="">erlang-questions@erlang.org</a><br class="">
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank" class="">http://erlang.org/mailman/listinfo/erlang-questions</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" target="_blank" class="">erlang-questions@erlang.org</a><br class=""><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank" class="">http://erlang.org/mailman/listinfo/erlang-questions</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">
erlang-questions mailing list<br class="">
<a href="mailto:erlang-questions@erlang.org" target="_blank" class="">erlang-questions@erlang.org</a><br class="">
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank" class="">http://erlang.org/mailman/listinfo/erlang-questions</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div></body></html>