# Get component action and page from the python exception stack

**URL:** <https://forum.inductiveautomation.com/t/get-component-action-and-page-from-the-python-exception-stack/75890>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [July 4, 2023, 12:22pm UTC](https://forum.inductiveautomation.com/t/get-component-action-and-page-from-the-python-exception-stack/75890 "2023-07-04T12:22:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [July 4, 2023, 12:22pm UTC](https://forum.inductiveautomation.com/t/get-component-action-and-page-from-the-python-exception-stack/75890/1 "2023-07-04T12:22:31Z")

</div>

in script, how to get in script: **component action** and **page** from the python exception stack

For example, when an exception is triggered:

```auto
Error running action 'component.onActionPerformed' on pages/test@D/root/Button_2:
Traceback (most recent call last): File "<function:runAction>", line 7, in runAction UnboundLocalError: local variable 'test' referenced before assignment

```

I would like to add some context information in my logger error message

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 4, 2023, 1:12pm UTC](https://forum.inductiveautomation.com/t/get-component-action-and-page-from-the-python-exception-stack/75890/2 "2023-07-04T13:12:24Z")

</div>

Those are from the thread-local [MDC](https://www.slf4j.org/api/org/slf4j/MDC.html), and should already be annotating your log messages.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [July 4, 2023, 1:18pm UTC](https://forum.inductiveautomation.com/t/get-component-action-and-page-from-the-python-exception-stack/75890/3 "2023-07-04T13:18:25Z")

</div>

yes I see, the only missing part is for example the information like **action 'component.onActionPerformed'**

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 5, 2023, 10:02pm UTC](https://forum.inductiveautomation.com/t/get-component-action-and-page-from-the-python-exception-stack/75890/4 "2023-07-05T22:02:39Z")

</div>

You can't, from scripting. The internal classes, hidden behind the SafetyWrapper implementations, do it via a method on [`AuditingContext`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/perspective/gateway/api/AuditingContext.html#getAuditSnapshot()), basically.
