Lager issue

John Kemp john at jkemp.net
Thu Jan 10 15:07:05 EST 2013


Thanks Andrew -- that works.

The reason I was doing stuff on the console is that this didn't work in my running application either.

lager:log(info, self(), "foo ~s", [bar]) also works fine in my app code. But the other commands do not.  Which makes me think that since:

> Lager doesn't actually define lager:info/3, the parse transform walks
> the AST of the module and replaces any calls to
> lager:(debug|info|notice|...) with some different code.

The parse transform is not happening in my compile.

If I add:

-compile([{parse_transform, lager_transform}]).

to each of my modules, then lager works. 

But when I set the options in rebar config it did not work. 

However, I found the solution - put the deps line in my rebar config before the erl_opts line. Then I make clean, make rel, and it all works. 

Unexpected to this particular rebar/lager novice.

JohnK

On Jan 10, 2013, at 1:22 PM, Andrew Thompson wrote:

> Lager doesn't actually define lager:info/3, the parse transform walks
> the AST of the module and replaces any calls to
> lager:(debug|info|notice|...) with some different code. So, since you're
> calling lager from the shell, the parse transform isn't involved and you
> get undef. If you want to log from the shell, you can use use
> lager:log(info, self(), "foo ~s", [bar]), or whatever.





More information about the riak-users mailing list