summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDaniil Fedotov <dfedotov@pivotal.io>2015-12-04 17:07:00 +0000
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2016-01-13 11:43:47 +0100
commit670d986641cebf3db4d24c4c18b0cbc8132a9829 (patch)
tree900bd93590e80e0f6ee839e44a890063505ec1f8 /docs
parent636142506ccf1fb65058fe0ae8d997edcc25af65 (diff)
downloadrabbitmq-server-git-670d986641cebf3db4d24c4c18b0cbc8132a9829.tar.gz
Use Lager to log RabbitMQ messages
By default, RabbitMQ now logs messages to a single file ($RABBITMQ_LOGS). The $RABBITMQ_SASL_LOGS variable is unused. To configure how and which messages are logged, it's recommended to do it from rabbitmq.config, not from the environment variable. The old `log_levels` parameter is unsupported and categories are replaced by Lager extra sinks. If you had in your rabbitmq.config: {rabbit, [ {log_levels, [{connection, info}]} ]} You can now configure Lager like this: {lager, [ {extra_sinks, [ {rabbit_connection_lager_event, [ {handlers, [{lager_forwarder_backend, [lager_event, info]}]} ]} ]} ]} rabbitmq-build.mk from rabbitmq-common is included in the top-level Makefile. It sets the appropriate compiler options to enable Lager's lager_transform parse_transform module. rabbit_log calls are now converted by this parse_transform to direct calls to lager:log(). To keep backward compatibility with other plugins, the rabbit_log module still implements all the <level>() functions. Compared to the parse_transformed calls, the main difference is the logged message does not carry the file:line metadata. Fixes #94.
Diffstat (limited to 'docs')
-rw-r--r--docs/rabbitmq.config.example46
1 files changed, 40 insertions, 6 deletions
diff --git a/docs/rabbitmq.config.example b/docs/rabbitmq.config.example
index eacdb8a993..42280cc0f5 100644
--- a/docs/rabbitmq.config.example
+++ b/docs/rabbitmq.config.example
@@ -38,12 +38,6 @@
%%
%% {handshake_timeout, 10000},
- %% Log levels (currently just used for connection logging).
- %% One of 'debug', 'info', 'warning', 'error' or 'none', in decreasing
- %% order of verbosity. Defaults to 'info'.
- %%
- %% {log_levels, [{connection, info}, {channel, info}]},
-
%% Set to 'true' to perform reverse DNS lookups when accepting a
%% connection. Hostnames will then be shown instead of IP addresses
%% in rabbitmqctl and the management plugin.
@@ -659,5 +653,45 @@
%% Set queries to determine which tags a user has
%%
%% {tag_queries, []}
+ ]},
+
+ %% Lager controls logging.
+ %% See https://github.com/basho/lager for more documentation
+ {lager, [
+ %%
+ %% Log direcrory, taken from the RABBITMQ_LOG_BASE env variable by default.
+ %% {log_root, "/var/log/rabbitmq"},
+ %%
+ %% All log messages go to the default "sink" configured with
+ %% the `handlers` parameter. By default, it has a single
+ %% lager_file_backend handler writing messages to "$nodename.log"
+ %% (ie. the value of $RABBIT_LOGS).
+ %% {handlers, [
+ %% {lager_file_backend, [{file, "rabbit.log"},
+ %% {level, info},
+ %% {date, ""},
+ %% {size, 0}]}
+ %% ]},
+ %%
+ %% Extra sinks are used in RabbitMQ to categorize messages. By
+ %% default, those extra sinks are configured to forward messages
+ %% to the default sink (see above). "rabbit_log_lager_event"
+ %% is the default category where all RabbitMQ messages without
+ %% a category go. Messages in the "channel" category go to the
+ %% "rabbit_channel_lager_event" Lager extra sink, and so on.
+ %% {extra_sinks, [
+ %% {rabbit_log_lager_event, [{handlers, [
+ %% {lager_forwarder_backend,
+ %% [lager_event, info]}]}]},
+ %% {rabbit_channel_lager_event, [{handlers, [
+ %% {lager_forwarder_backend,
+ %% [lager_event, info]}]}]},
+ %% {rabbit_conection_lager_event, [{handlers, [
+ %% {lager_forwarder_backend,
+ %% [lager_event, info]}]}]},
+ %% {rabbit_mirroring_lager_event, [{handlers, [
+ %% {lager_forwarder_backend,
+ %% [lager_event, info]}]}]}
+ %% ]}
]}
].