I know this issue was raised few times but I didn't found a solution yet. I cant use the logger
My steps:
1. Download Erlang
2. Download & compile eJabrred with the code from
3. My code:
-module(mod_hello).
-behavior(gen_mod).
-include("ejabberd.hrl").
-include("lager.hrl").
-include("jlib.hrl").
-export([
start/2,
stop/1
]).
start(_Host, _Opt) ->
?DEBUG("Loaded mode_hello", []).
%ok.
stop(_Host) ->
ok.
Error:
13:15:27.670 [critical] Problem starting the module mod_hello for host <<"localhost">>
options: []
error: undef
[{p1_logger,info_msg,
[mod_hello,16,"Loading module 'mod_hello' ",[]],
[]},
{gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,82}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1336}]},
{ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,67}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},{line,272}]}]
13:15:27.671 [critical] ejabberd initialization was aborted because a module start failed.
Tried also to rebeat:
./rebar get-deps
./rebar compile
cp -R deps/* /lib/ejabberd/include/
but with the same error.
also when I'm trying to compile & run mod_echo everything is OK, but when I'm adding a new line with msg_info I get the same error as in my mode_hello.
Any ideas
Can't use Logger
First of all, instead of lager you should include this one, as I see in all the ejabberd code:
-include("logger.hrl").
Don't do that cp -R, this should be done automatically.
Also, try running: ./autogen.sh
And also try running again: ./configure
when you include "logger.hl"
when you include "logger.hl" don't forget to compile with -DLAGER
Why not simply use "make ;
Why not simply use "make ; sudo make install" to build? If you use the Makefile in the Ejabberd directory, you shouldn't need any special options to compile it with logger support. I only ran into trouble with the logger when trying to compile modules manually.