summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Ionescu <vlad@lshift.net>2009-09-23 13:58:05 +0100
committerVlad Ionescu <vlad@lshift.net>2009-09-23 13:58:05 +0100
commit936e4de0ee9cf55ebb08246e2c367c8c64c66b51 (patch)
tree1b7e9fa2442e89a397037a80556d1af64f96aa69
parentaf9bb2a7bc33b126aa38792138d5dd922978e0aa (diff)
downloadrabbitmq-server-936e4de0ee9cf55ebb08246e2c367c8c64c66b51.tar.gz
broker now prints the location of rabbit.app on startup
-rw-r--r--src/rabbit.erl14
-rw-r--r--src/rabbit_misc.erl16
2 files changed, 26 insertions, 4 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index ef1e0049..2b292412 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -215,6 +215,11 @@ log_location(Type) ->
_ -> undefined
end.
+app_location() ->
+ {ok, Application} = application:get_application(),
+ rabbit_misc:absolute_path(
+ code:where_is_file(atom_to_list(Application) ++ ".app")).
+
%---------------------------------------------------------------------------
print_banner() ->
@@ -237,10 +242,11 @@ print_banner() ->
[Product, string:right([$v|Version], ProductLen),
?PROTOCOL_VERSION_MAJOR, ?PROTOCOL_VERSION_MINOR,
?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE]),
- Settings = [{"node", node()},
- {"log", log_location(kernel)},
- {"sasl log", log_location(sasl)},
- {"database dir", rabbit_mnesia:dir()}],
+ Settings = [{"node", node()},
+ {"app descriptor", app_location()},
+ {"log", log_location(kernel)},
+ {"sasl log", log_location(sasl)},
+ {"database dir", rabbit_mnesia:dir()}],
DescrLen = lists:max([length(K) || {K, _V} <- Settings]),
Format = "~-" ++ integer_to_list(DescrLen) ++ "s: ~s~n",
lists:foreach(fun ({K, V}) -> io:format(Format, [K, V]) end, Settings),
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 95a274e3..1af02ddf 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -55,6 +55,7 @@
-export([format_stderr/2]).
-export([start_applications/1, stop_applications/1]).
-export([unfold/2, ceil/1]).
+-export([absolute_path/1]).
-import(mnesia).
-import(lists).
@@ -124,6 +125,7 @@
-spec(stop_applications/1 :: ([atom()]) -> 'ok').
-spec(unfold/2 :: (fun ((A) -> ({'true', B, A} | 'false')), A) -> {[B], A}).
-spec(ceil/1 :: (number()) -> number()).
+-spec(absolute_path/1 :: (string()) -> string()).
-endif.
@@ -475,3 +477,17 @@ ceil(N) ->
0 -> N;
_ -> 1 + T
end.
+
+absolute_path(RelPath) ->
+ filename:join(absolute_path([], filename:split(filename:absname(RelPath)))).
+
+absolute_path([_ | ResultParts], [".." | Parts]) ->
+ absolute_path(ResultParts, Parts);
+absolute_path([], [".." | Parts]) ->
+ absolute_path([], Parts);
+absolute_path(ResultParts, ["." | Parts]) ->
+ absolute_path(ResultParts, Parts);
+absolute_path(ResultParts, [Part | Parts]) ->
+ absolute_path([Part | ResultParts], Parts);
+absolute_path(ResultParts, []) ->
+ lists:reverse(ResultParts).