From d560b5969490c6bd68cd3e376b8dfb6591f11f66 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Sun, 16 Aug 2009 20:35:30 +0000 Subject: QPID-2016: Add ability to reload the Log4J configuration file on request using the management console git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@804767 13f79535-47bb-0310-9956-ffa450edef68 --- .../logging/management/LoggingManagementMBean.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'java/broker') diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java b/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java index e1e6cb49b5..1ab9d913c8 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java @@ -753,4 +753,41 @@ public class LoggingManagementMBean extends AMQManagedObject implements LoggingM LOCK.unlock(); } } + + public synchronized void reloadConfigFile() throws IOException + { + try + { + LOCK.lock(); + + QpidLog4JConfigurator.configure(_log4jConfigFileName); + _logger.info("Applied log4j configuration from: " + _log4jConfigFileName); + } + catch (IllegalLoggerLevelException e) + { + _logger.warn("The log4j configuration reload request was aborted: " + e); + //recommended that MBeans should use standard java.* and javax.* exceptions only + throw new IOException("The log4j configuration reload request was aborted: " + e.getMessage()); + } + catch (ParserConfigurationException e) + { + _logger.warn("The log4j configuration reload request was aborted: " + e); + throw new IOException("The log4j configuration reload request was aborted: " + e.getMessage()); + } + catch (SAXException e) + { + _logger.warn("The log4j configuration reload request was aborted: " + e); + //recommended that MBeans should use standard java.* and javax.* exceptions only + throw new IOException("The log4j configuration reload request was aborted: " + e.getMessage()); + } + catch (IOException e) + { + _logger.warn("The log4j configuration reload request was aborted: " + e); + throw new IOException("The log4j configuration reload request was aborted: " + e.getMessage()); + } + finally + { + LOCK.unlock(); + } + } } -- cgit v1.2.1