Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
markaren committed Jun 17, 2019
1 parent 9cf5ebb commit 291f698
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class GrpcFmuServer(
override fun stop() {
if (isRunning) {
server?.also {
LOG.info("Stopping ${javaClass.simpleName} ...")
LOG.debug("Stopping ${javaClass.simpleName} ...")
it.shutdownNow()
it.awaitTermination()
LOG.info("${javaClass.simpleName} stopped!")
LOG.debug("${javaClass.simpleName} stopped!")
}
server = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class GrpcFmuServiceImpl(
if (guid !in fmus) {
val fmu = AbstractFmu.from(url)
fmus[guid] = fmu
LOG.info("Loaded new FMU with guid=$guid!")
LOG.info("Loaded new FMU '${fmu.modelDescription.modelName}' with guid=$guid!")
} else {
LOG.debug("FMU with guid=$guid already loaded, re-using it!")
}
Expand All @@ -86,7 +86,7 @@ class GrpcFmuServiceImpl(
synchronized(fmus) {
if (guid !in fmus) {
fmus[guid] = fmu
LOG.info("Loaded new FMU with guid=$guid!")
LOG.info("Loaded new FMU '${fmu.modelDescription.modelName}' with guid=$guid!")
} else {
fmu.close()
LOG.debug("FMU with guid=$guid already loaded, re-using it!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ abstract class ThriftFmuServer(

override fun stop() {
server?.also {
LOG.info("Stopping ${javaClass.simpleName} ...")
LOG.debug("Stopping ${javaClass.simpleName} ...")
it.stop()
LOG.info("${javaClass.simpleName} stopped!")
LOG.debug("${javaClass.simpleName} stopped!")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class ThriftFmuServiceImpl(
if (guid !in fmus) {
val fmu = AbstractFmu.from(url)
fmus[guid] = fmu
LOG.info("Loaded new FMU with guid=$guid!")
LOG.info("Loaded new FMU '${md.modelName}' with guid=$guid!")
} else {
LOG.debug("FMU with guid=$guid already loaded, re-using it!")
LOG.debug("FMU '${md.modelName}' with guid=$guid already loaded, re-using it!")
}
return guid
}
Expand All @@ -86,10 +86,10 @@ class ThriftFmuServiceImpl(
synchronized(fmus) {
if (guid !in fmus) {
fmus[guid] = fmu
LOG.info("Loaded new FMU with guid=$guid!")
LOG.info("Loaded new FMU '${fmu.modelDescription.modelName}' with guid=$guid!")
} else {
fmu.close()
LOG.debug("FMU with guid=$guid already loaded, re-using it!")
LOG.info("FMU '${fmu.modelDescription.modelName}' with guid=$guid already loaded, re-using it!")
}
return guid
}
Expand Down Expand Up @@ -177,9 +177,11 @@ class ThriftFmuServiceImpl(
}

override fun terminate(instanceId: InstanceId): Status {
return getSlave(instanceId).let {
it.terminate()
it.lastStatus.thriftType()
return getSlave(instanceId).let { slave ->
slave.terminate()
val status = slave.lastStatus
LOG.info("Terminated instance of ${slave.modelDescription.modelName} with status $status")
status.thriftType()
}
}

Expand Down Expand Up @@ -306,4 +308,3 @@ class ThriftFmuServiceImpl(
// }

}

0 comments on commit 291f698

Please sign in to comment.