View the wrapper.log File in a Client or Designer

The Perfect Abstractions development team recently released an Ignition project that enables people to easily see the wrapper.log file in a client or designer.

This project solves the problem of not having remote access to an Ignition server in order to view the wrapper.log file. But even with remote access to an Ignition server, this project makes it easier to access and view the wrapper.log file.

More information about the project is available in this blog post: View the Ignition wrapper.log File in the Designer or Client

Here’s the project. Download it and import/upload it into Ignition to install it: WrapperLogViewer.proj

Information about what the wrapper.log file is and why it is useful is here: What is the Ignition wrapper.log File and Why it is Useful?

Here’s a screenshot of the WrapperLogViewer project:


1 Like

One caveat is that that importing the script will overwrite whatever you may already have in the project (Nick had warned me of it, and I think it’s mentioned in his blog post. But it is worth a re-mention :wink:).

I imported into a standalone project. From there, I can copy/paste as needed. :thumb_left:

Good points from Jordan. :thumb_left:

Uploading/importing the WrapperLogViewer.proj as a standalone project and then copy/paste the wrapper.log viewer window into other projects is a good idea.

Hello, the project is not available, can you upload it here? Thank you

Nick doesn’t do Ignition any more.

1 Like

@JordanCClark share the project :laughing: :laughing:

I didn’t even hear the horn before I was tossed under the bus. :smirk:

This is the (slightly modified for v8) script that the project was based on. Adjust file and tag paths accordingly. It writes to a string tag and a date tag.

import os
import datetime
import sys

path = "/usr/local/bin/ignition/logs/wrapper.log"
tagPaths = ["WrapperLog/LogContent", "WrapperLog/LastModified"]
t = os.path.getmtime(path)
modified = datetime.datetime.fromtimestamp(t)

lastModified = system.tag.readBlocking([tagPaths[1]])[0]
if lastModified.value == None:
	from java.util import Date
	lastModified.value = Date(0)
	
def datetimeToJavaDate(value):
	from java.util import Calendar, GregorianCalendar
	cal = GregorianCalendar(value.year, value.month - 1, value.day, 
		value.hour, value.minute, value.second)
	cal.set (Calendar.MILLISECOND, value.microsecond / 1000)
	return cal.getTime()
	
if lastModified.value.before(datetimeToJavaDate(modified)):
	content = system.file.readFileAsString(path)
	if len(content) > 64000:
		content = content[-64000:]
	system.tag.writeBlocking(tagPaths, [content, modified])

3 Likes

This is the original project from @nmudge
WrapperLogViewer.proj (23.7 KB)

1 Like