summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2008-10-24 22:07:38 +0000
committerBadlop <badlop@process-one.net>2008-10-24 22:07:38 +0000
commit9e55a1291a136e67ad7069c5e4c721584f0a4383 (patch)
tree3b4c2f767599da5711bfc36a32fd3ca5717b841b /src
parent* src/ejabberd_c2s.erl: Ensure unique ID in roster push (EJAB-721) (diff)
* 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
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_app.erl39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl
index 50f8a44f..5f385586 100644
--- a/src/ejabberd_app.erl
+++ b/src/ejabberd_app.erl
@@ -29,7 +29,7 @@
-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").
@@ -45,6 +45,7 @@ start(normal, _Args) ->
db_init(),
sha:start(),
stringprep_sup:start_link(),
+ start(),
translate:start(),
acl:start(),
ejabberd_ctl:init(),
@@ -53,7 +54,6 @@ start(normal, _Args) ->
gen_mod:start(),
ejabberd_config:start(),
ejabberd_check:config(),
- start(),
connect_nodes(),
Sup = ejabberd_sup:start_link(),
ejabberd_rdbms:start(),
@@ -65,12 +65,13 @@ start(normal, _Args) ->
%fprof:trace(start, "/tmp/fprof"),
start_modules(),
ejabberd_listener:start_listeners(),
+ ?INFO_MSG("ejabberd ~s is started in the node ~p", [?VERSION, node()]),
Sup;
start(_, _) ->
{error, badarg}.
%% 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.
prep_stop(State) ->
stop_modules(),
@@ -79,6 +80,7 @@ prep_stop(State) ->
%% All the processes were killed when this function is called
stop(_State) ->
+ ?INFO_MSG("ejabberd ~s is stopped in the node ~p", [?VERSION, node()]),
ok.
@@ -93,18 +95,7 @@ init() ->
register(ejabberd, self()),
%erlang:system_flag(fullsweep_after, 0),
%error_logger:logfile({open, ?LOG_PATH}),
- LogPath =
- 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,
+ LogPath = get_log_path(),
error_logger:add_report_handler(ejabberd_logger_h, LogPath),
erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv),
case erl_ddll:load_driver(ejabberd:get_so_path(), expat_erl) of
@@ -171,3 +162,21 @@ connect_nodes() ->
end, Nodes)
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.