Enabling Item Attributes in Item Level Events and Logging
You can set a flag to enable the inclusion of item attributes in item-level events, and item-level logging. By default, item attributes are not included to avoid exposing sensitive data.
You enable the publication of data attributes by setting the datahub.event.data-attributes.enabled property to true in your local.properties file. When the property is true, data attributes are included with all item level events that you enable. When it is false, no data attributes are included with any item level events. If left unspecified, Data Hub sets the value of datahub.event.data-attributes.enabled to false by default.
The datahub.event.data-attributes.enabled property enables the publication of item attributes for the following events:
- RawItemEvent
- CanonicalItemEvent
- ArchivedCanonicalItemEvent
- TargetItemEvent
- CanonicalItemPublicationStatusEvent
Note that NoMorePublicationAttemptsEvent does not include any data attributes.
Item level attribute publication is possible only when the corresponding item level event is enabled. Logging of item attributes is only possible when datahub.item.level.lifecycle.logging is also enabled. To include all item attributes for all events, and also log all item events, add the following to your local.properties file:
datahub.event.rawitem.enabled=true datahub.event.canonicalitem.enabled=true datahub.event.targetitem.enabled=true datahub.item.level.lifecycle.logging=true datahub.event.data-attributes.enabled=true
Example Log Output
With all events, logging, and item attribute publication enabled, you see output similar to the following in the logs. Item attributes appear in the fields={ } section of the logging line.
Raw Item Event
INFO] [c.h.d.l.i.RawItemLoggingService] GLOBAL RawCategory id=1 delete=false isoCode=en action=1 fields={sourceId=1, parent=null, name=category name 1, description=category description} traceId=eb75e85d-e417-35a2-a9f5-fd4445329a41 batchId=1
Canonical Item Event
[INFO] [c.h.d.l.i.CanonicalItemLoggingService] GLOBAL CanonicalCategory id=1 action=1 status=SUCCESS integrationKey='6' fields={identifier=6, parent=null, name={en=category name 6}, description={en=category description}} rawSources=[6] traceId=eb75e85d-e417-35a2-a9f5-fd4445329a41 batchId=1
Target Item Event
[INFO] [c.h.d.l.i.TargetItemLoggingService] GLOBAL Category id=1 canonicalItem=16 action=1 targetSystem='HybrisApparelCoreInstallation' fields={catalogVersion=, superCategories=null, code=16, name={en=category name 16}, description={en=category description}} exportCode=Category
With all events and logging enabled, but item attribute publication disabled, the fields={ } section is not included.
Raw Item Event
[INFO] [c.h.d.l.i.RawItemLoggingService] GLOBAL RawCategory id=1 delete=false isoCode=en action=1 traceId=8c75b4b0-fb16-30fa-b4ef-7d93c1edb218 batchId=1
Canonical Item Event
INFO] [c.h.d.l.i.CanonicalItemLoggingService] GLOBAL CanonicalCategory id=1 action=1 status=SUCCESS integrationKey='16' rawSources=[16] traceId=8c75b4b0-fb16-30fa-b4ef-7d93c1edb218 batchId=1
Target Item Event
INFO] [c.h.d.l.i.TargetItemLoggingService] GLOBAL Category id=1 canonicalItem=7 action=1 targetSystem='HybrisApparelCoreInstallation' exportCode=Category