You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2024/07/30 11:57:23 UTC

(brooklyn-server) 02/04: better logging for entity id and name on creation

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 2e8ba6e5998d8dc1c61d1ba16983b6f7ed51e218
Author: Alex Heneveld <gi...@alex.heneveld.org>
AuthorDate: Tue Jul 30 10:56:36 2024 +0100

    better logging for entity id and name on creation
---
 .../brooklyn/core/objs/proxy/InternalEntityFactory.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/brooklyn/core/objs/proxy/InternalEntityFactory.java b/core/src/main/java/org/apache/brooklyn/core/objs/proxy/InternalEntityFactory.java
index b0f7454ed7..f83a1ce4af 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/proxy/InternalEntityFactory.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/proxy/InternalEntityFactory.java
@@ -249,11 +249,18 @@ public class InternalEntityFactory extends InternalFactory {
             if (!options.isDryRun()) {
                 // entity.getParent and .getApplicationId not available yet; but spec.getParent does have them;
                 // we want to show the message before initialization happens
+                Object planId = ((EntityInternal) entity).config().getRaw(BrooklynConfigKeys.PLAN_ID).orNull();
+
+                String name = entity.getId() + " " +
+                        (planId != null ? planId + " / " : "") +
+                        entity.getDisplayName() + " " +
+                        "(" + entity + ")";
                 if (spec.getParent() == null) {
-                    BrooklynLoggingCategories.APPLICATION_LIFECYCLE_LOG.debug("Creating application " + entity.getId() + " (" + entity + ") for user " + Entitlements.getEntitlementContextUser());
+                    BrooklynLoggingCategories.APPLICATION_LIFECYCLE_LOG.debug("Creating application " + name +
+                            " for user " + Entitlements.getEntitlementContextUser());
                 } else {
-                    BrooklynLoggingCategories.ENTITY_LIFECYCLE_LOG.debug("Creating entity " + entity.getId() + " (" + entity + ") " +
-                            "for user " + Entitlements.getEntitlementContextUser() + ", "+
+                    BrooklynLoggingCategories.ENTITY_LIFECYCLE_LOG.debug("Creating entity " + name +
+                            " for user " + Entitlements.getEntitlementContextUser() + ", "+
                             "child of " +
                             (!Objects.equals(spec.getParent().getId(), spec.getParent().getApplicationId())
                                     ? "entity " + spec.getParent().getId() + " in "