https://issues.apache.org/jira/browse/AMQ-3100 - setting factory instead of using system property

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1058613 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2011-01-13 15:41:33 +00:00
parent 14d5dcee8c
commit 5f01344411
1 changed files with 6 additions and 14 deletions

View File

@ -16,13 +16,8 @@
*/
package org.apache.activemq.broker.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class AuditLogService {
private static final Log LOG = LogFactory.getLog(AuditLogService.class);
private AuditLogFactory factory;
private static AuditLogService auditLog;
@ -35,14 +30,7 @@ public class AuditLogService {
}
private AuditLogService() {
String auditLogFactory = System.getProperty("org.apache.activemq.audit.factory", "org.apache.activemq.broker.util.DefaultAuditLogFactory");
try {
factory = (AuditLogFactory) Class.forName(auditLogFactory).newInstance();
} catch (Exception e) {
LOG.warn("Cannot instantiate audit log factory '" + auditLogFactory + "', using default audit log factory", e);
factory = new DefaultAuditLogFactory();
}
factory = new DefaultAuditLogFactory();
}
public void log(String message) {
@ -50,4 +38,8 @@ public class AuditLogService {
log.log(message);
}
}
}
public void setFactory(AuditLogFactory factory) {
this.factory = factory;
}
}