Set policy fragment globally & get logging even when an error occurs

For each policy we are using, we have a policy fragment that includes all the logging we want to have. We placed this policy fragment at the end of each policy.

Is it possible to set the policy fragment globally, so that it runs automatically on every policy? It doesn't have to be a policy fragment, but I’m looking for a way to automatically get specified logging of every policy/request

Because we have placed the policy fragment at the end of the policies, it doesn’t provide us with any logging if the policy doesn't make it to the end of the policy.

It there a way to provide us with logging nomatter if the policy makes it to the end of a policy?

Unfortunately with the broad nature of this, it is a bit difficult to narrow down specific answers to your questions. But I'll attempt here with a few notes, hopefully this will help answer your questions or can help move it forward for you.

If you want something done on every policy, no matter the policy, then setting it up in a global policy is generally the recommendation. In fact, logging is even one of the examples provided for the benefit of a global policy.

Of course, there are some limitations with a global policy, so make sure that is all kept in mind for your use-cases. Such limitations are referenced on the bottom of the documentation page referenced below.

It depends on what type of information you want logged, but make note of that with regards to which location you choose for the global policy (in terms of on receive or on completion). The types of global policy fragments that can be used when a policy fails, for example, is also referenced on the documentation page below.

With a global message-received or message-completed policy, they will still be executed even if a target policy fails.

Unfortunately with the broad nature of this, it is a bit difficult to narrow down specific answers to your questions. But I'll attempt here with a few notes, hopefully this will help answer your questions or can help move it forward for you.

If you want something done on every policy, no matter the policy, then setting it up in a global policy is generally the recommendation. In fact, logging is even one of the examples provided for the benefit of a global policy.

Of course, there are some limitations with a global policy, so make sure that is all kept in mind for your use-cases. Such limitations are referenced on the bottom of the documentation page referenced below.

It depends on what type of information you want logged, but make note of that with regards to which location you choose for the global policy (in terms of on receive or on completion). The types of global policy fragments that can be used when a policy fails, for example, is also referenced on the documentation page below.

With a global message-received or message-completed policy, they will still be executed even if a target policy fails.