# Script \`print()\` statements do not show up in the Output Console

**URL:** <https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [July 4, 2023, 2:14pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895 "2023-07-04T14:14:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 4, 2023, 2:14pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/1 "2023-07-04T14:14:24Z")

</div>

is there some setting to allow scripts to print to Output Console? it works fine in the Script Console window, but does not in the Output Console.

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [July 4, 2023, 2:40pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/2 "2023-07-04T14:40:05Z")

</div>

If using perspective, try `system.perspective.print('Hello World')`

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 4, 2023, 3:04pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/3 "2023-07-04T15:04:11Z")

</div>

`print()` calls end up in the wrapper.log file, I believe. The previously mentioned `system.perspective.print()` is the correct way to log session info in Perspective. If you want information logged at the Gateway level, then you should use `system.util.getLogger()` to create a logger, and then `.info()` to log a message.

While the script console can be used to test some scripts, it should not be used as an indication your script will work in all situations, as there are various scopes a script could be executed in.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 4, 2023, 8:27pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/4 "2023-07-04T20:27:01Z")

</div>

> [@cmallonee](#):
>
> If you want information logged at the Gateway level, then you should use `system.util.getLogger()`

Just note that, if you use a logger in different scopes, eg the designer script console or in Vision, then the logger will be created within that scope. For example, the designer loggers are accessed from Help -\> Diagnostics, and under.. one of the tabs (i forget that name). Also take note of the minimum logger level being logged for your logger. The default is INFO, and you won't see any TRACE logs.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 4, 2023, 9:34pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/5 "2023-07-04T21:34:39Z")

</div>

okay. i have stored most of this for future reference, TBH. all i'm looking for is a dump to the Output Console so i can keep track of variable contents, &c without having to open a bajillion windows, most of which stop the script from running thus defeating the purpose. i know i have a lot to learn, and maybe i just need to make some tags to dump stuff to and then watch them in the Tag Browser (?), but i'll give `system.perspective.print()` a whirl and see if that's the bunny i'm hunting.

thank you all. get back to you shortly.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 5, 2023, 12:45am UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/6 "2023-07-05T00:45:49Z")

</div>

By far the simplest for initial testing of scripts in Perspective is to use `system.perspective.print` which will write to the browser's console (for the Designer, this is the Designer's console). For production however, you should be utilising loggers (`system.util.getLogger(loggerName)`) and log any `error`s, `info`, and/or `trace` logs to these. The preference is to create script libraries within the _Scripting_ section of the Designer for the majority of your code, and call these functions from within your gui. I normally init a logger at the top of each script library which I use in all of the functions within the library:

```auto
LIBRARY = 'shared.util.something'
LOGGER = system.util.getLogger('Scripting-{}'.format(LIBRARY))
def foo():
    LOGGER.trace("i'm here!")
    LOGGER.info('hello!')
    LOGGER.error('goodbye!')

```

To view the logs, just go to the gateway Status webpage and to the Logs section. From there, you can filter to the script library you're looking at, and if needed, also change the minimum logging level to TRACE while you're testing to see your trace messages.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 5, 2023, 1:16pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/7 "2023-07-05T13:16:12Z")

</div>

this is some top-flight info here! wow. lemme make sure i understand:

at the top of every script you write, you add that code snippet to log anything that script does when you call `LOGGER.trace/info/error...` from within that script's functions. which then show up in the Ignition gateway's Logs; each prefaced log prefaced by `Scripting-make.pancakes`, for example. and in this case the `LIBRARY` would be `make.pancakes`, of which the `foo` function is a part.

do i have that correct? if so, that's fantastic! thank you. incredibly helpful.

if i don't, show me where i goofed up. 😃

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 5, 2023, 2:25pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/8 "2023-07-05T14:25:18Z")

</div>

No, the code snippet is placed at the top of each script LIBRARY (`Scripting > Project Library > X`). Then, as he's using that library he uses the logger of that specific library for clarity on where the logging is originating from.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [July 5, 2023, 2:32pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/9 "2023-07-05T14:32:25Z")

</div>

Just going to put this here for some more clarification on 'print()'

> [@Event Configuration Print Out to debug](https://forum.inductiveautomation.com/t/event-configuration-print-out-to-debug/60091/5):
>
> It’s complicated slight_smile Starting from most local to least… In the script console, print will log directly to the output buffer on the right hand side. system.util.getLogger() will log to the named ‘Output Console’ Designer window. Bonus: A script invoked from here using system.util.invokeAsync will print to the regular output console, not the buffer on the right hand side. Anywhere else in the designer (except Perspective), print and system.util.getLogger will log to the ‘Out…

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 5, 2023, 4:21pm UTC](https://forum.inductiveautomation.com/t/script-print-statements-do-not-show-up-in-the-output-console/75895/10 "2023-07-05T16:21:37Z")

</div>

\*click\* got it. thanks @nminchin. still getting up to speed here, but this has proven very useful in having a solid foundation. good logging, for me, is critical, so starting off on the best foot possible is a great blessing. thanks again. 😃
