# Accessing Diagnostic Logs in Perspective

**URL:** <https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 27, 2022, 9:01pm UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954 "2022-11-27T21:01:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [November 27, 2022, 9:01pm UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/1 "2022-11-27T21:01:47Z")

</div>

I would like to display the diagnostic logs from the gateway into a perspective container. Is this possible? I was not able to find a function that does this in the manual nor did I find anything on the exchange.

---

<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:** [November 28, 2022, 2:02am UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/2 "2022-11-28T02:02:54Z")

</div>

No can do natively. You probably won't be able to nest it inside an iframe either. You'll likely have to read the wrapper log file and display that

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [November 28, 2022, 3:01am UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/3 "2022-11-28T03:01:24Z")

</div>

I figured that was the only answer but doesn't hurt to ask, thanks.

---

<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:** [November 28, 2022, 4:18pm UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/4 "2022-11-28T16:18:51Z")

</div>

From the gateway context (e.g. via [`system.util.getContext`](https://forum.inductiveautomation.com/t/ignition-extensions-convenience-utilities-for-advanced-users/64615)) you can [get the logging manager](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.22/com/inductiveautomation/ignition/gateway/model/GatewayContext.html#getLoggingManager()) and then [query for log events](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.22/com/inductiveautomation/ignition/gateway/logging/GatewayLoggingManager.html#queryLogEvents(com.inductiveautomation.ignition.common.logging.LogQueryConfig)); this will be the same view of log events provided by the logging web interface, and thus is _missing_ anything logged to `stdout` or `stderr` of the Java process, which is captured in the wrapper log.

So, pros: more direct and structured access, cons: less events visible.

---

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [September 1, 2023, 12:57am UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/5 "2023-09-01T00:57:50Z")

</div>

Hi Paul,

Would you please illustrate a bit more in detail how this function can be achieved?  
Is it to prepare the script in gateway event to query the log details?

---

<div class="post-metadata">

**Author:** ![tyler.bennett](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@tyler.bennett](https://forum.inductiveautomation.com/u/tyler.bennett)\
**Post date:** [August 4, 2025, 2:45am UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/6 "2025-08-04T02:45:44Z")

</div>

1. It is possible to display the gateway log viewer (https://[ipaddress]/web/status/diag.logviewer) through a Perspective `Inline Frame` component. In my implementation I had `Config > Security > General > Status Page Permissions` left blank (public security level). I am not exactly sure what obstacles a more restricted security setup might introduce.
2. It appears very possible to retrieve logger information (as suggested by @paul-griffith) and potentially build your own log viewer in Perspective . Here is a starting point I derived from [code provided](https://forum.inductiveautomation.com/t/scripting-to-read-gateway-logs/64402/7#code-for-prosperity-1) by @kgamble (and left here for my own future reference).

```python
from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.common.logging import LogQueryConfig
	
loggingManager = IgnitionGateway.get().getLoggingManager()
	
logQueryConfigBuilder = LogQueryConfig.newBuilder()
# May add filters to LogQueryConfigBuilder object

logQueryFilter = logQueryConfigBuilder.build()
# May add filters to LogQueryFilter object

logQueryFilter.setLimit(10)
	
logResults = loggingManager.queryLogEvents(logQueryFilter)
	
logEvents = logResults.getEvents()

events = []
for event in logEvents:
	events.append({
		 'exception' : event.getException()
		,'level' : event.getLevel()
		,'loggerName': event.getLoggerName()
		,'marker' : event.getMarker()
		,'message' : event.getMessage()
		,'properties': event.getProperties()
		,'source' : event.getSourceLocation()
		,'timestamp' : system.date.fromMillis(event.getTimestamp())
	})

```

There are lots of filtering options than can be applied using methods available on the [`LogQueryConfigBuilder`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.48/com/inductiveautomation/ignition/common/logging/LogQueryConfig.LogQueryConfigBuilder.html) and [`LogQueryConfig`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.48/com/inductiveautomation/ignition/common/logging/LogQueryConfig.html) class objects.

Screenshot showing gateway log viewer exposed in Perspective Inline Frame component.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/2/228eeb509c3a33294bb20162bdbbe99a27671c1b.png)

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [August 4, 2025, 2:59pm UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/7 "2025-08-04T14:59:29Z")

</div>

It is not retrieving IgnitionGateway Library. But it does import the LogQueryConfig ImportError: cannot import name IgnitionGateway

---

<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:** [August 4, 2025, 3:26pm UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/8 "2025-08-04T15:26:40Z")

</div>

N.B. that in 8.3 you'll be able to use an API token to authenticate against the same REST API the backend uses to populate the logs form so you don't need the iframe/public access, you can have your Perspective frontend actually fetch the data.

---

<div class="post-metadata">

**Author:** ![tyler.bennett](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@tyler.bennett](https://forum.inductiveautomation.com/u/tyler.bennett)\
**Post date:** [August 4, 2025, 3:27pm UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/9 "2025-08-04T15:27:23Z")

</div>

> [@CTrenkamp](#):
>
> It is not retrieving IgnitionGateway Library.

Not at a computer right now, but be sure to run this in a perspective view (event script or property binding) and not from the designer script console. The script console in designer runs in a context that is basically equivalent to a Vision client.

---

<div class="post-metadata">

**Author:** ![CTrenkamp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ctrenkamp/32/38440_2.png) [@CTrenkamp](https://forum.inductiveautomation.com/u/CTrenkamp)\
**Post date:** [August 4, 2025, 4:15pm UTC](https://forum.inductiveautomation.com/t/accessing-diagnostic-logs-in-perspective/66954/10 "2025-08-04T16:15:55Z")

</div>

I have an 8.3 test environment so I'll give it a try.
