# Output Console Buffer problems

**URL:** <https://forum.inductiveautomation.com/t/output-console-buffer-problems/9610>\
**Category:** Ignition\
**Created:** [January 27, 2015, 9:58pm UTC](https://forum.inductiveautomation.com/t/output-console-buffer-problems/9610 "2015-01-27T21:58:39Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 27, 2024, 3:26pm UTC](https://forum.inductiveautomation.com/t/output-console-buffer-problems/9610/3 "2024-01-27T15:26:05Z")

</div>

> [@axelf911](#):
>
> If there is no solution to this, is there a way to dump my data to a log file.

@Daniel_Webb

It's simple enough to script:  
**Example:**  
Create a library script called console scripts _(or whatever seems logical for the given design environment)_ **:**  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/f/df65aa44d05914c8e87866cc3baf5f98ad29b72f.png)

Create various console utility functions such as getting the console, getting the console text, creating a log file, and for clearing the console

```auto
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:

```auto
# 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)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/output-console-buffer-problems/9610)._
