erlang.mk icon indicating copy to clipboard operation
erlang.mk copied to clipboard

wrong RELX_REL_NAME when using -logger_level info or debug

Open jordanchaitin opened this issue 2 years ago • 3 comments

In the erlang.mk file, the default ERL is defined as ERL = erl +A1 -noinput -boot no_dot_erlang To enable info level logging, I add -kernel logger_level info to this.

When I do this, the make fails with an error

/bin/sh: _rel/=PROGRESS/bin/=PROGRESS: not found
gmake: *** [erlang.mk:7571: run] Error 127

For some reason it seems to take RELX_REL_NAME as =PROGRESS when the logger_level info or debug is added to erl. It works fine when the logger_level is set to warning.

jordanchaitin avatar Dec 25 '21 07:12 jordanchaitin

Looking deeper, the trouble is in the logic of setting the value of RELX_REL.

When the logger level is not set explicitly, the value assigned to RELX_REL is projectname_release 1 1 . So when RELX_REL_NAME is taken as $(word, 1, $(RELX_REL)) it is fine.

However, when the logger level is set to info or debug, the value assigned to RELX_REL, which is the output of $(shell $(call erlang,$(get_relx_release.erl))) is =PROGRESS REPORT==== 25-Dec-2021::13:15:47.923955 === application: kernel started_at: nonode@nohost =PROGRESS REPORT==== 25-Dec-2021::13:15:47.938103 === application: stdlib started_at: nonode@nohost projectname_release 1 1

So when RELX_REL_NAME is taken as $(word, 1, $(RELX_REL)) it gets =PROGRESS.

jordanchaitin avatar Dec 25 '21 08:12 jordanchaitin

Yes but we can't really do much about that. Why do you want to enable info logging for all Erlang.mk commands? If you want in the release you can use the vm.args file.

essen avatar Dec 26 '21 16:12 essen

Yes but we can't really do much about that.

The 1st short string (projectname_release 1 1) is the last 3 words of the 2nd long string with the progress report.

Will it be a valid approach to use functions like $(word n,text) , $(words text) , to get the last 3 words of the long string? (This function should also work for the short string by itself.)

I could try it and do a PR if you think this will be useful.

But I don't know if it is necessary to update the ERL definition in the makefile like OP suggests, or if it is sufficient to just add the logger config in the vm.args file and leave the default definition of ERL

ahron1 avatar Dec 26 '21 17:12 ahron1

The ERL is used to retrieve information via the output in Erlang.mk so adding debug logging would only work if the logging was done to a file. But maybe it's easier if users define their own MY_ERL with what they want if they need it. Not sure it can be better than that. Closing, thanks!

essen avatar May 16 '23 07:05 essen