summaryrefslogtreecommitdiff
path: root/scripts/rabbitmq-server
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 /scripts/rabbitmq-server
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 'scripts/rabbitmq-server')
-rwxr-xr-xscripts/rabbitmq-server19
1 files changed, 6 insertions, 13 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index 69c2b7ff6c..303383eb1b 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -76,22 +76,15 @@ RABBITMQ_CONFIG_ARG=
RABBITMQ_LISTEN_ARG=
[ "x" != "x$RABBITMQ_NODE_PORT" ] && [ "x" != "x$RABBITMQ_NODE_IP_ADDRESS" ] && RABBITMQ_LISTEN_ARG="-rabbit tcp_listeners [{\""${RABBITMQ_NODE_IP_ADDRESS}"\","${RABBITMQ_NODE_PORT}"}]"
-# If $RABBITMQ_LOGS is '-', send all log messages to stdout. Likewise
-# for RABBITMQ_SASL_LOGS. This is particularily useful for Docker
-# images.
+# If $RABBITMQ_LOGS is '-', send all log messages to stdout. This is
+# particularily useful for Docker images.
if [ "$RABBITMQ_LOGS" = '-' ]; then
- RABBIT_ERROR_LOGGER='tty'
-else
- RABBIT_ERROR_LOGGER='{file,"'${RABBITMQ_LOGS}'"}'
-fi
-
-if [ "$RABBITMQ_SASL_LOGS" = '-' ]; then
SASL_ERROR_LOGGER=tty
- RABBIT_SASL_ERROR_LOGGER='tty'
+ RABBIT_LAGER_HANDLER=tty
else
SASL_ERROR_LOGGER=false
- RABBIT_SASL_ERROR_LOGGER='{file,"'${RABBITMQ_SASL_LOGS}'"}'
+ RABBIT_LAGER_HANDLER='"'${RABBITMQ_LOGS}'"'
fi
# we need to turn off path expansion because some of the vars, notably
@@ -116,8 +109,8 @@ start_rabbitmq_server() {
${RABBITMQ_LISTEN_ARG} \
-sasl errlog_type error \
-sasl sasl_error_logger "$SASL_ERROR_LOGGER" \
- -rabbit error_logger "$RABBIT_ERROR_LOGGER" \
- -rabbit sasl_error_logger "$RABBIT_SASL_ERROR_LOGGER" \
+ -rabbit lager_log_root "\"$RABBITMQ_LOG_BASE\"" \
+ -rabbit lager_handler "$RABBIT_LAGER_HANDLER" \
-rabbit enabled_plugins_file "\"$RABBITMQ_ENABLED_PLUGINS_FILE\"" \
-rabbit plugins_dir "\"$RABBITMQ_PLUGINS_DIR\"" \
-rabbit plugins_expand_dir "\"$RABBITMQ_PLUGINS_EXPAND_DIR\"" \