Skip to content

Commit

Permalink
[WFLY-4563] Clean up system-jmx logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamezp committed Jun 18, 2015
1 parent 1ba5ff5 commit 2b0cdd5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
24 changes: 9 additions & 15 deletions system-jmx/src/main/java/org/jboss/system/ServiceMBeanSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public class ServiceMBeanSupport extends NotificationBroadcasterSupport implemen
public ServiceMBeanSupport() {
// can not call this(Class) because we need to call getClass()
this.log = Logger.getLogger(getClass().getName());
if (log.isTraceEnabled()) {
log.trace("Constructing");
}
log.trace("Constructing");
}

/**
Expand Down Expand Up @@ -118,9 +116,7 @@ public ServiceMBeanSupport(final String category) {
*/
public ServiceMBeanSupport(final Logger log) {
this.log = log;
if (log.isTraceEnabled()) {
log.trace("Constructing");
}
log.trace("Constructing");
}

/**
Expand Down Expand Up @@ -170,15 +166,15 @@ public void stop() {
try {
jbossInternalStop();
} catch (Throwable t) {
log.warn(ServiceMBeanLogger.ROOT_LOGGER.errorInStop(t, jbossInternalDescription()));
log.warn(ServiceMBeanLogger.ROOT_LOGGER.errorInStop(jbossInternalDescription()), t);
}
}

public void destroy() {
try {
jbossInternalDestroy();
} catch (Throwable t) {
log.warn(ServiceMBeanLogger.ROOT_LOGGER.errorInDestroy(t, jbossInternalDescription()));
log.warn(ServiceMBeanLogger.ROOT_LOGGER.errorInDestroy(jbossInternalDescription()), t);
}
}

Expand Down Expand Up @@ -225,7 +221,7 @@ protected void jbossInternalCreate() throws Exception {
createService();
state = CREATED;
} catch (Exception e) {
log.warn(ServiceMBeanLogger.ROOT_LOGGER.initializationFailed(e, jbossInternalDescription()));
log.warn(ServiceMBeanLogger.ROOT_LOGGER.initializationFailed(jbossInternalDescription()), e);
throw e;
}

Expand Down Expand Up @@ -260,7 +256,7 @@ protected void jbossInternalStart() throws Exception {
} catch (Exception e) {
state = FAILED;
sendStateChangeNotification(STARTING, FAILED, getName() + " failed", e);
log.warn(ServiceMBeanLogger.ROOT_LOGGER.startingFailed(e, jbossInternalDescription()));
log.warn(ServiceMBeanLogger.ROOT_LOGGER.startingFailed(jbossInternalDescription()), e);
throw e;
}

Expand Down Expand Up @@ -296,7 +292,7 @@ protected void jbossInternalStop() {
} catch (Throwable e) {
state = FAILED;
sendStateChangeNotification(STOPPING, FAILED, getName() + " failed", e);
log.warn(ServiceMBeanLogger.ROOT_LOGGER.stoppingFailed(e, jbossInternalDescription()));
log.warn(ServiceMBeanLogger.ROOT_LOGGER.stoppingFailed(jbossInternalDescription()), e);
return;
}

Expand Down Expand Up @@ -328,7 +324,7 @@ protected void jbossInternalDestroy() {
try {
destroyService();
} catch (Throwable t) {
log.warn(ServiceMBeanLogger.ROOT_LOGGER.destroyingFailed(t, jbossInternalDescription()));
log.warn(ServiceMBeanLogger.ROOT_LOGGER.destroyingFailed(jbossInternalDescription()), t);
}
state = DESTROYED;
if (log.isDebugEnabled()) {
Expand Down Expand Up @@ -367,9 +363,7 @@ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Except

public void postRegister(Boolean registrationDone) {
if (!registrationDone.booleanValue()) {
if (log.isDebugEnabled()) {
log.debug("Registration is not done -> stop");
}
log.debug("Registration is not done -> stop");
stop();
} else {
state = REGISTERED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;

Expand All @@ -44,22 +43,22 @@ public interface ServiceMBeanLogger extends BasicLogger {
IllegalArgumentException unknownLifecycleMethod(String methodName);

@Message(id = 3, value = "Error in destroy %s")
IllegalArgumentException errorInDestroy(@Cause Throwable cause, String description);
String errorInDestroy(String description);

@Message(id = 4, value = "Error in stop %s")
IllegalArgumentException errorInStop(@Cause Throwable cause, String description);
String errorInStop(String description);

@Message(id = 5, value = "Initialization failed %s")
IllegalArgumentException initializationFailed(@Cause Throwable cause, String description);
String initializationFailed(String description);

@Message(id = 6, value = "Starting failed %s")
IllegalArgumentException startingFailed(@Cause Throwable cause, String description);
String startingFailed(String description);

@Message(id = 7, value = "Stopping failed %s")
IllegalArgumentException stoppingFailed(@Cause Throwable cause, String description);
String stoppingFailed(String description);

@Message(id = 8, value = "Destroying failed %s")
IllegalArgumentException destroyingFailed(@Cause Throwable cause, String description);
String destroyingFailed(String description);

@Message(id = 9, value = "Initialization failed during postRegister")
String postRegisterInitializationFailed();
Expand Down

0 comments on commit 2b0cdd5

Please sign in to comment.