It's simple enough to script:
Example:
Create a library script called console scripts (or whatever seems logical for the given design environment):
Create various console utility functions such as getting the console, getting the console text, creating a log file, and for clearing the console
from com.inductiveautomation.ignition.client.util.gui import OutputConsole
from java.awt.event import ActionEvent
# Recursive function searches the subcomponents of the console until the textpane is located,
# ...and then returns its text property
def getConsoleText(console):
for component in console.components:
if component.__class__.__name__ == 'JTextPane':
return component.text
else:
textpaneText = getConsoleText(component)
if textpaneText:
return textpaneText
# Appends the given text to the end of a log file
def logConsoleText(consoleText):
# Define the path and file name of the log file
filepath = 'C:/Users/testUser/Desktop/consoleLog.txt' #!!! Change this as needed
# Append the console text to the end of the log file
system.file.writeFile(filepath, consoleText, True)
# Programatically clears the console
def clearOutputConsole(console):
# Clear the console in preparation for the next batch
console.actionPerformed(ActionEvent(console, 0, 'clear'))
# Retrieves an instance of the output console
def getOutputConsole():
return OutputConsole.getInstance()
Then call the utility scripts as needed whenever periodic console specific log dumps are needed:
# Get the output console from the designer
console = consoleScripts.getOutputConsole()
# Get the text from the console
consoleText = consoleScripts.getConsoleText(console)
# Dump the console text to a file
consoleScripts.logConsoleText(consoleText)
# Clear the console in preparation for the next batch
consoleScripts.clearOutputConsole(console)