# Project is not logging

**URL:** <https://forum.inductiveautomation.com/t/project-is-not-logging/101515>\
**Category:** Ignition\
**Tags:** ignition80, ignition81\
**Created:** [January 28, 2025, 6:50pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515 "2025-01-28T18:50:53Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Burger\_King](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Burger\_King](https://forum.inductiveautomation.com/u/Burger_King)\
**Post date:** [January 28, 2025, 6:50pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/1 "2025-01-28T18:50:53Z")

</div>

I have an Igntion project that will not log any information to the Gateway. I am using logger = system.util.getLogger('TheLoggerName'). I have also checked the logging levels in my project and the gateway and they are set to the same level. Is there anyone that can help me figure out what the issue is?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 28, 2025, 6:53pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/2 "2025-01-28T18:53:44Z")

</div>

Where are you running the script that calls the function with a logger? Have you confirmed that this script is actually getting called?

If you are testing in the designer then the logging will be in the designer.

If you are running in vision then it will be logging to the local client logger.

Perspective will log to gateway, regardless of designer or actual session.

---

<div class="post-metadata">

**Author:** ![Burger\_King](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Burger\_King](https://forum.inductiveautomation.com/u/Burger_King)\
**Post date:** [January 28, 2025, 7:01pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/4 "2025-01-28T19:01:45Z")

</div>

I have a logger in the projects startup event. But I cannot see its statement in Diagnostics or in the Gateway. I place the logging statement in the beggining so I believe call to the logger is being made. This is a Perspective project by the way.

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [January 28, 2025, 7:06pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/5 "2025-01-28T19:06:28Z")

</div>

Try copying the same code to a button so you know for certain it is executing your code. Try executing it from designer so it will yell at you if you have a code error.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 28, 2025, 7:09pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/6 "2025-01-28T19:09:15Z")

</div>

Just eliminating possibilities, does your script actually call to log something? Ie, `logger.warn('Oops something broke')`

---

<div class="post-metadata">

**Author:** ![Burger\_King](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Burger\_King](https://forum.inductiveautomation.com/u/Burger_King)\
**Post date:** [January 28, 2025, 7:10pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/7 "2025-01-28T19:10:50Z")

</div>

Yes, it does. Just a simple "hello world" using the INFO filter

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 28, 2025, 7:13pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/8 "2025-01-28T19:13:01Z")

</div>

> [@Burger\_King](#):
>
> This is a Perspective project by the way.

Perspective sessions tend to be a bit sticky, how are you testing the project startup script?

Try launching a session in an incognito tab of your browser and see if you see your logger message. I don't believe project startup will fire from designer.

---

<div class="post-metadata">

**Author:** ![Burger\_King](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Burger\_King](https://forum.inductiveautomation.com/u/Burger_King)\
**Post date:** [January 28, 2025, 7:14pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/9 "2025-01-28T19:14:22Z")

</div>

I was able to add a button. Inside of the onclick event, I added logging. But I am not seeing that in the designer, in the gateway or in the console.

---

<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:** [January 28, 2025, 7:44pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/10 "2025-01-28T19:44:38Z")

</div>

Show your actual code.

---

<div class="post-metadata">

**Author:** ![Burger\_King](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Burger\_King](https://forum.inductiveautomation.com/u/Burger_King)\
**Post date:** [January 28, 2025, 7:52pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/11 "2025-01-28T19:52:05Z")

</div>

This is what I have in the projects startup gateway event:

```python
logger = system.util.getLogger("myLoggerTest")
logger.warn("inside of startup")
system.util.getLogger("myLoggerTest2").info("This is a log message")

```

I have that code at the very top of the Startup Event.

---

<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:** [January 28, 2025, 7:54pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/12 "2025-01-28T19:54:11Z")

</div>

That will log only to the gateway. Look carefully at your gateway.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 28, 2025, 7:56pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/13 "2025-01-28T19:56:18Z")

</div>

When do you want this to log, on new Perspective session startup or on gateway startup?

> [@Burger\_King](#):
>
> startup gateway event:

This makes it sound like you put it in the gateway startup event instead of the session startup event.

Session startup event - fired on startup of perspective session  
Gateway Startup event - fired on startup of your gateway

---

<div class="post-metadata">

**Author:** ![Burger\_King](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Burger\_King](https://forum.inductiveautomation.com/u/Burger_King)\
**Post date:** [January 28, 2025, 7:59pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/14 "2025-01-28T19:59:55Z")

</div>

I would like to log in different placess but it doesn't matter this point. If I can get any logging from the project, I will be happy.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 28, 2025, 8:03pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/15 "2025-01-28T20:03:13Z")

</div>

> [@Burger\_King](#):
>
> ```python
> logger = system.util.getLogger("myLoggerTest")
> logger.warn("inside of startup")
> 
> ```

This inside of a button script should work.

For project library loggers, the following generalized format should work:

```python
import blah

logger = system.util.getLogger('project.library.' + __name__ )

def myFunction(paramA):
	""" """
	for x in xrange(10):
		pass
	
	logger.info("Done!")
	
	return

```

---

<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:** [January 28, 2025, 8:06pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/16 "2025-01-28T20:06:16Z")

</div>

Does your code editor for button actions or event definitions show any red squiggles for syntax errors in the right margins?

---

<div class="post-metadata">

**Author:** ![Burger\_King](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Burger\_King](https://forum.inductiveautomation.com/u/Burger_King)\
**Post date:** [January 28, 2025, 9:09pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/17 "2025-01-28T21:09:40Z")

</div>

No, the code editor does not show any red squiggles.

---

<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:** [January 28, 2025, 9:11pm UTC](https://forum.inductiveautomation.com/t/project-is-not-logging/101515/18 "2025-01-28T21:11:38Z")

</div>

Are you saving your project before testing gateway scope code?

Are you _ **sure** _ the gateway you are checking for logs is the same gateway your designer is connected to?
