# Reporting: Logging does not work inside chart script

**URL:** <https://forum.inductiveautomation.com/t/reporting-logging-does-not-work-inside-chart-script/117333>\
**Category:** Ignition\
**Created:** [October 5, 2026, 3:26pm UTC](https://forum.inductiveautomation.com/t/reporting-logging-does-not-work-inside-chart-script/117333 "2026-10-05T15:26:19Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [October 5, 2026, 4:20pm UTC](https://forum.inductiveautomation.com/t/reporting-logging-does-not-work-inside-chart-script/117333/4 "2026-10-05T16:20:11Z")

</div>

1. Move your code to a project library script, and move all imports **outside** the `def`, along with the creation of the `logger` object (so it is persistent).

2. In the first line inside the `def`, invoke the logger.

3. Ideally, nest all the rest of the code in a double-except `try:` construct, so you can log both java and jython errors. Something like this:

> [@Database connection Faulted - Errors list](https://forum.inductiveautomation.com/t/database-connection-faulted-errors-list/115944/3):
>
> There's no fixed list, as different JDBC drivers all have there own error messages. Also, the only reliable point to trap errors is in scripted calls to perform database operations, where you use a double except clause. Something like this in a project library script: from java.lang import Throwable def someProcessingFunction(someArgument): # .... try: result = system.db.runPrepQuery(....) except Throwable, t: # handle java and jdbc errors here except Exceptio…

---

_[View the full topic](https://forum.inductiveautomation.com/t/reporting-logging-does-not-work-inside-chart-script/117333)._
