---
title: "Entity journaling"
slug: "entity-journaling"
abstract: "Overview of Commerce entity journaling that you can use to preserve a complete log of all changes made to an entity."
---
# Entity journaling

The Commerce Engine encompasses extensible services that enable you to customize commerce functionality.

> [!note]
> Do not extend or inherit from out-of-the-box policies; instead, create your own. You can change the values in a policy by modifying the PolicySet JSON or the Environment JSON, depending on where the policy is defined and then re-running Bootstrap.

When enabled for an entity type, entity journaling sets a flag to update a journal whenever the entity changes. The journaling process saves a complete copy of the previous version of the changed entities, providing a log of all changes.

> [!note]
> The journaling entries can considerably increase the size of the Shared Environments database since journaling creates a copy of the complete entity, and not just the changed entity fields or properties. For example, every time an order status changes, a complete copy of the order entity is stored in the database.
>
> Starting with Sitecore 10.1, you can configure the Commerce Engine to [archive order journaling entries](https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-commerce/entity-archiving.html "Entity archiving") to help reduce the number of order journaling entries in the Shared Environment database.
>
> Alternatively, you can consider [disabling entity journaling](https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-commerce/entity-journaling.html#UUID-8767124d-3604-b857-66e6-b2f9403f14db_section-idm231984773860149 "Change Commerce Entity journaling configuration") for Commerce entities that do not have auditing requirements.

The following policy can be configured through the Journaling plug-in.

| Policy | Description | Properties / Default Values |
| --- | --- | --- |
| `EntityJournalingPolicy` | Defines the name of the journals list and the full entity type. | Journal \ "EntityJournal"<br><br>EntityFullName\ string.Empty |

The following is an example of a `EntityJournalingPolicy`:

```csharp
{
     EntityFullName = "Sitecore.Commerce.Plugin.Orders.Order",
     Journal = "OrdersJournal"
 }

```

The `EntityPersistenceJournalingBlock` checks the `EntityJournalingPolicy` for rules on how to journalize the entity.

<details>
<summary><h2>Change Commerce Entity journaling configuration</h2></summary>

You can enable or disable journaling for a Commerce Entity by changing the `EntityJournalingPolicy` policy in the Commerce environment configuration file. For example, to change the journaling behavior in the sample Habitat Authoring environment, you modify the `wwwroot\CommerceAuthoring_Sc\wwwroot\data\EnvironmentsPlugIn.Habitat.CommerceAuthoring-*.*.*.json` file.

To enable journaling, for example, of changes to the Customer entity in the sample Habitat Authoring environment:

1. Open the `wwwroot\CommerceAuthoring_Sc\wwwroot\data\EnvironmentsPlugIn.Habitat.CommerceAuthoring-*.*.*.json` file.
2. In the file, add the `EntityJournalingPolicy` policy, specify the entity name (`EntityFullName`), and the journal name:

    ```

    "$type": "Sitecore.Commerce.Plugin.Journaling.EntityJournalingPolicy, Sitecore.Commerce.Plugin.Journaling",
            "EntityFullName": "Sitecore.Commerce.Plugin.Customers.Customer",
            "Journal": "CustomersJournal"
    ```

3. Save your changes and [bootstrap the Commerce Engine](https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-commerce/bootstrap-the-commerce-engine.html "Bootstrap the Commerce Engine").

    > [!note]
    > To disable journaling of a given Commerce entity type, delete the corresponding `EntityJournalingPolicy` policy block from the environment configuration file.
    >
    > If journaling is disabled for an entity where it was previously enabled, the journal entries are not removed; it will simply no longer create new ones.

</details>