brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #617: Persist management plane ID
Date Wed, 19 Apr 2017 12:16:40 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/617#discussion_r112185296
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalManagementContext.java
---
    @@ -224,6 +224,7 @@ public String getManagementPlaneId() {
         public void setManagementPlaneId(String newPlaneId) {
             if (managementPlaneId != null && !managementPlaneId.equals(newPlaneId))
{
                 log.warn("Management plane ID changed from {} to {}", managementPlaneId,
newPlaneId);
    +            log.debug("Management plane ID changed from {} to {}", new Object[] {managementPlaneId,
newPlaneId}, new RuntimeException("Stack trace for setManagementPlaneId"));
    --- End diff --
    
    Good spot @geomacy. The fix might surprise you though (it surely did surprise me):
    ```
    log.debug("Management plane ID changed from {} to {}", new Object[] {managementPlaneId,
newPlaneId, new RuntimeException("Stack trace for setManagementPlaneId")});
    ```
    
    Turns out slf4j will [do the right thing](https://www.slf4j.org/faq.html#paramException)
in this case and log the last argument as an exception. Verified the debug log contains:
    
    ```
    2017-04-19 15:11:34,011 DEBUG o.a.b.c.m.i.LocalManagementContext [brooklyn-execmanager-KWNkyI3R-3]:
Management plane ID changed from X7dpWzuF to wJl3j3K1
    java.lang.RuntimeException: Stack trace for setManagementPlaneId
            at org.apache.brooklyn.core.mgmt.internal.LocalManagementContext.setManagementPlaneId(LocalManagementContext.java:227)
[classes/:na]
            at org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl.updateLocalPlaneId(HighAvailabilityManagerImpl.java:465)
[classes/:na]
            at org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl.checkMaster(HighAvailabilityManagerImpl.java:725)
[classes/:na]
            at org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl.publishAndCheck(HighAvailabilityManagerImpl.java:602)
[classes/:na]
            at org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl$2.run(HighAvailabilityManagerImpl.java:557)
[classes/:na]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_80]
            at org.apache.brooklyn.util.core.task.BasicExecutionManager$ScheduledTaskCallable$1.call(BasicExecutionManager.java:451)
[classes/:na]
            at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:529)
[classes/:na]
            at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_80]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[na:1.7.0_80]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[na:1.7.0_80]
            at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80]
    
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message