mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-08 21:43:07 +02:00
* src/ejabberd_app.erl: Open ejabberd.log sooner, so errors during
ejabberd initialization are logged in that file (EJAB-777). Write a log message when ejabberd finishes the start or stop. SVN Revision: 1667
This commit is contained in:
parent
426e75a298
commit
9e55a1291a
|
@ -1,3 +1,9 @@
|
||||||
|
2008-10-25 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/ejabberd_app.erl: Open ejabberd.log sooner, so errors during
|
||||||
|
ejabberd initialization are logged in that file (EJAB-777). Write
|
||||||
|
a log message when ejabberd finishes the start or stop.
|
||||||
|
|
||||||
2008-10-24 Badlop <badlop@process-one.net>
|
2008-10-24 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
* src/ejabberd_c2s.erl: Ensure unique ID in roster push (EJAB-721)
|
* src/ejabberd_c2s.erl: Ensure unique ID in roster push (EJAB-721)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
-behaviour(application).
|
-behaviour(application).
|
||||||
|
|
||||||
-export([start_modules/0,start/2, prep_stop/1, stop/1, init/0]).
|
-export([start_modules/0,start/2, get_log_path/0, prep_stop/1, stop/1, init/0]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ start(normal, _Args) ->
|
||||||
db_init(),
|
db_init(),
|
||||||
sha:start(),
|
sha:start(),
|
||||||
stringprep_sup:start_link(),
|
stringprep_sup:start_link(),
|
||||||
|
start(),
|
||||||
translate:start(),
|
translate:start(),
|
||||||
acl:start(),
|
acl:start(),
|
||||||
ejabberd_ctl:init(),
|
ejabberd_ctl:init(),
|
||||||
|
@ -53,7 +54,6 @@ start(normal, _Args) ->
|
||||||
gen_mod:start(),
|
gen_mod:start(),
|
||||||
ejabberd_config:start(),
|
ejabberd_config:start(),
|
||||||
ejabberd_check:config(),
|
ejabberd_check:config(),
|
||||||
start(),
|
|
||||||
connect_nodes(),
|
connect_nodes(),
|
||||||
Sup = ejabberd_sup:start_link(),
|
Sup = ejabberd_sup:start_link(),
|
||||||
ejabberd_rdbms:start(),
|
ejabberd_rdbms:start(),
|
||||||
|
@ -65,12 +65,13 @@ start(normal, _Args) ->
|
||||||
%fprof:trace(start, "/tmp/fprof"),
|
%fprof:trace(start, "/tmp/fprof"),
|
||||||
start_modules(),
|
start_modules(),
|
||||||
ejabberd_listener:start_listeners(),
|
ejabberd_listener:start_listeners(),
|
||||||
|
?INFO_MSG("ejabberd ~s is started in the node ~p", [?VERSION, node()]),
|
||||||
Sup;
|
Sup;
|
||||||
start(_, _) ->
|
start(_, _) ->
|
||||||
{error, badarg}.
|
{error, badarg}.
|
||||||
|
|
||||||
%% Prepare the application for termination.
|
%% Prepare the application for termination.
|
||||||
%% This function is called when an application is about to be stopped,
|
%% This function is called when an application is about to be stopped,
|
||||||
%% before shutting down the processes of the application.
|
%% before shutting down the processes of the application.
|
||||||
prep_stop(State) ->
|
prep_stop(State) ->
|
||||||
stop_modules(),
|
stop_modules(),
|
||||||
|
@ -79,6 +80,7 @@ prep_stop(State) ->
|
||||||
|
|
||||||
%% All the processes were killed when this function is called
|
%% All the processes were killed when this function is called
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
|
?INFO_MSG("ejabberd ~s is stopped in the node ~p", [?VERSION, node()]),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,18 +95,7 @@ init() ->
|
||||||
register(ejabberd, self()),
|
register(ejabberd, self()),
|
||||||
%erlang:system_flag(fullsweep_after, 0),
|
%erlang:system_flag(fullsweep_after, 0),
|
||||||
%error_logger:logfile({open, ?LOG_PATH}),
|
%error_logger:logfile({open, ?LOG_PATH}),
|
||||||
LogPath =
|
LogPath = get_log_path(),
|
||||||
case application:get_env(log_path) of
|
|
||||||
{ok, Path} ->
|
|
||||||
Path;
|
|
||||||
undefined ->
|
|
||||||
case os:getenv("EJABBERD_LOG_PATH") of
|
|
||||||
false ->
|
|
||||||
?LOG_PATH;
|
|
||||||
Path ->
|
|
||||||
Path
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
error_logger:add_report_handler(ejabberd_logger_h, LogPath),
|
error_logger:add_report_handler(ejabberd_logger_h, LogPath),
|
||||||
erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv),
|
erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv),
|
||||||
case erl_ddll:load_driver(ejabberd:get_so_path(), expat_erl) of
|
case erl_ddll:load_driver(ejabberd:get_so_path(), expat_erl) of
|
||||||
|
@ -171,3 +162,21 @@ connect_nodes() ->
|
||||||
end, Nodes)
|
end, Nodes)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
%% @spec () -> string()
|
||||||
|
%% Returns the full path to the ejabberd log file.
|
||||||
|
%% It first checks for application configuration parameter 'log_path'.
|
||||||
|
%% If not defined it checks the environment variable EJABBERD_LOG_PATH.
|
||||||
|
%% And if that one is neither defined, returns the default value:
|
||||||
|
%% "ejabberd.log" in current directory.
|
||||||
|
get_log_path() ->
|
||||||
|
case application:get_env(log_path) of
|
||||||
|
{ok, Path} ->
|
||||||
|
Path;
|
||||||
|
undefined ->
|
||||||
|
case os:getenv("EJABBERD_LOG_PATH") of
|
||||||
|
false ->
|
||||||
|
?LOG_PATH;
|
||||||
|
Path ->
|
||||||
|
Path
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user