INFO_MSG method fails in ejabberd

2019-08-15 08:35发布

问题:

I am trying to write a custom module in ejabberd XMPP server. This is the erl module i'v written.

-module(mod_wish). 
-behavior(gen_mod).
-include("logger.hrl").
-export([
   start/2,
   stop/1
 ]).
 start(_Host, _Opt) ->
    ?INFO_MSG("Loading module 'mod_wish' ", []),
    ok.
 stop(_Host) ->
    ok.

I can compile it without any errors. But after i add this module to config file and restart the ejabberd server, serve does not start. it says

C(<0.38.0>:gen_mod:75) : Problem starting the module mod_wish for host "localhost"

.
Erlang log does not say anything. If i remove the line
?INFO_MSG("Loading module 'mod_wish' ", []), then it works. Is it a problem with lager logging framework? How can i make this correct? Can any one help me. I am totally new to erlang.
Thanks

回答1:

If you are using ejabberd 13.12. You should put your file in ejabberd/src/, then compile it with entire server.