adplus-dvertising

For ActiveMQ Artemis, how to separate the log message produced by LoggingActiveMQServerPlugin into different log file?

Asked 2 days ago
Viewed 5 times

I turn on LoggingActiveMQServerPlugin in order to record some information. But I don't want those information in artemis.log. I hope those information could be saved into a separated file so that I can manage it easily.

I know I should work with the file logging.properties, but I don't know how to configure the file. Could anybody provide a samlpe?

Appreciate.

asked 2 days ago

Correct Answer

Here's what you need to do:

  1. Add org.apache.activemq.artemis.core.server.plugin.impl to the loggers list.
  2. Direct org.apache.activemq.artemis.core.server.plugin.impl to a new handler
  3. Configure the new handler to point to a unique file.

For example, this configuration will direct output from LoggingActiveMQServerPlugin to logging_plugin.log in the log directory next to artemis.log:

...
loggers=...,org.apache.activemq.artemis.core.server.plugin.impl
...
logger.org.apache.activemq.artemis.core.server.plugin.impl.level=ERROR
logger.org.apache.activemq.artemis.core.server.plugin.impl.handlers=LOGGING_PLUGIN
logger.org.apache.activemq.artemis.core.server.plugin.impl.useParentHandlers=false
...
handler.LOGGING_PLUGIN=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.LOGGING_PLUGIN.level=DEBUG
handler.LOGGING_PLUGIN.properties=suffix,append,autoFlush,fileName
handler.LOGGING_PLUGIN.suffix=.yyyy-MM-dd
handler.LOGGING_PLUGIN.append=true
handler.LOGGING_PLUGIN.autoFlush=true
handler.LOGGING_PLUGIN.fileName=${artemis.instance}/log/logging_plugin.log
handler.LOGGING_PLUGIN.formatter=PATTERN
answered 2 days ago