Skip to content

Commit

Permalink
[MSC-49] Log service start failures
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlloyd committed Dec 6, 2010
1 parent 92f143a commit 1541c50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/jboss/msc/service/ServiceInstanceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ public void run() {
doExecute(tasks);
} catch (StartException e) {
e.setServiceName(serviceName);
ServiceLogger.INSTANCE.startFailed(e, serviceName);
final Runnable[] tasks;
synchronized (ServiceInstanceImpl.this) {
final ContextState oldState = context.state;
Expand Down Expand Up @@ -1121,7 +1122,7 @@ public void run() {
}
context.state = ContextState.FAILED;
asyncTasks--;
startException = new StartException("Failed to start service", t, location, serviceName);
ServiceLogger.INSTANCE.startFailed(startException = new StartException("Failed to start service", t, location, serviceName), serviceName);
if (ServiceContainerImpl.PROFILE_OUTPUT != null) {
writeProfileInfo('F', startNanos, System.nanoTime());
}
Expand Down Expand Up @@ -1448,6 +1449,9 @@ public void failed(final StartException reason) throws IllegalStateException {
throw new IllegalStateException(ILLEGAL_CONTROLLER_STATE);
}
state = ContextState.FAILED;
final ServiceName serviceName = getName();
reason.setServiceName(serviceName);
ServiceLogger.INSTANCE.startFailed(reason, serviceName);
startException = reason;
failCount ++;
asyncTasks--;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jboss/msc/service/ServiceLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ interface ServiceLogger {
@Message(id = 10, value = "An error occurred while trying to close the profile output file: %s")
void profileOutputCloseFailed(/* ! @Cause */ IOException cause);

@LogMessage(level = ERROR)
@Message(id = 11, value = "Service \"%s\" failed to start")
void startFailed(@Cause StartException cause, ServiceName serviceName);

ServiceLogger INSTANCE = Logger.getMessageLogger(ServiceLogger.class, "org.jboss.msc");
}

0 comments on commit 1541c50

Please sign in to comment.