On Thu, Jan 10, 2013 at 01:11:18PM -0500, John Kemp wrote:
> Hi,
> 
> I don't usually have issues with lager, but in logging for my application, I 
> feel like I've done all the right things:
> 
> i) Put lager_transform in my rebar config:
> 
> {erl_opts, [debug_info, warnings_as_errors, {parse_transform, 
> lager_transform}]}.
> 
> ii) Lager is started when my app starts, and I know by asking at the console:
> 
> ([email protected])3> application:which_applications().
> [{lilith,[],"1"},
>  {lager,"Erlang logging framework","0.9.4"},
>  {crypto,"CRYPTO version 2","2.2"},
>  {sasl,"SASL  CXC 138 11","2.2.1"},
>  {stdlib,"ERTS  CXC 138 10","1.18.3"},
>  {kernel,"ERTS  CXC 138 10","2.15.3"}]
> 
> Then:
> 
> ([email protected])4> application:start(lager).
> {error,{already_started,lager}}
> 
> And yet... 
> 
> ([email protected])5> lager:info("foo ~s", [bar]).     
> ** exception error: undefined function lager:info/2
> ([email protected])6> lager:error("foo ~s", [bar]).
> ** exception error: undefined function lager:error/2
> ([email protected])7> lager:warning("foo ~s", [bar]).
> ** exception error: undefined function lager:warning/2
> ([email protected])8> lager:info("Hello!").                   
> ** exception error: undefined function lager:info/1
> 
> Can anyone tell me why lager continues to give me 'undef'?
> 
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.

Andrew

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to