<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.phidgets.com/docs/index.php?action=history&amp;feed=atom&amp;title=Phidget_Logging</id>
	<title>Phidget Logging - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.phidgets.com/docs/index.php?action=history&amp;feed=atom&amp;title=Phidget_Logging"/>
	<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Phidget_Logging&amp;action=history"/>
	<updated>2026-04-30T05:18:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Phidget_Logging&amp;diff=33986&amp;oldid=prev</id>
		<title>Lmpacent: /* Advanced Use */</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Phidget_Logging&amp;diff=33986&amp;oldid=prev"/>
		<updated>2023-08-03T22:27:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Advanced Use&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:27, 3 August 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l91&quot;&gt;Line 91:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 91:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Log Rotation===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Log Rotation===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Log rotation is enabled by default. When the log file reaches 10MiB, the Phidget library will automatically archive the contents in a new file at the same location. The new file will be timestamped showing when the rotation occurred.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Log rotation is enabled by default. When the log file reaches 10MiB, the Phidget library will automatically archive the contents in a new file at the same location. The new file will be timestamped showing when the rotation occurred.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Logging_logrotation.png|center|link=]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Logging_logrotation.png|center|link=]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If the log file reaches 10MiB again, the previous archive will be deleted, and a new one will be created in its place. As a result of the default behavior, the maximum amount of space that log files will use is 20MiB.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If the log file reaches 10MiB again, the previous archive will be deleted, and a new one will be created in its place. As a result of the default behavior, the maximum amount of space that log files will use is 20MiB.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You can change the maximum log file size (from 32 KiB to 10 MiB) and the number of log archives to keep (up to 64) through the Logging API.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You can change the maximum log file size (from 32 KiB to 10 MiB) and the number of log archives to keep (up to 64) through the Logging API.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lmpacent</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Phidget_Logging&amp;diff=33929&amp;oldid=prev</id>
		<title>Lmpacent: Created page with &quot;Category:Overview __TOC__ &lt;center&gt;A log file generated by the Phidget library&lt;/center&gt; ==What Is Phidget Logging?== The Phidget library can automatically create a timestamped log describing the state of your program for you. This is extremely useful for debugging purposes and is recommended for all Phidget programs. &lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;br&gt;&lt;br&gt; ===Enabl...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Phidget_Logging&amp;diff=33929&amp;oldid=prev"/>
		<updated>2023-08-03T20:12:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/docs/Category:Overview&quot; title=&quot;Category:Overview&quot;&gt;Category:Overview&lt;/a&gt; __TOC__ &lt;a href=&quot;/docs/File:Logging_logfileexample.png&quot; title=&quot;File:Logging logfileexample.png&quot;&gt;400px|link=https://www.phidgets.com/docs/images/8/8d/Logging_logfileexample.png|thumb|&amp;lt;center&amp;gt;A log file generated by the Phidget library&amp;lt;/center&amp;gt;&lt;/a&gt; ==What Is Phidget Logging?== The Phidget library can automatically create a timestamped log describing the state of your program for you. This is extremely useful for debugging purposes and is recommended for all Phidget programs. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; ===Enabl...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Overview]]&lt;br /&gt;
__TOC__&lt;br /&gt;
[[Image:Logging_logfileexample.png|400px|link=https://www.phidgets.com/docs/images/8/8d/Logging_logfileexample.png|thumb|&amp;lt;center&amp;gt;A log file generated by the Phidget library&amp;lt;/center&amp;gt;]]&lt;br /&gt;
==What Is Phidget Logging?==&lt;br /&gt;
The Phidget library can automatically create a timestamped log describing the state of your program for you. This is extremely useful for debugging purposes and is recommended for all Phidget programs.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===Enable Logging===&lt;br /&gt;
Only one line of code is required to enable logging. After setting a [[#Log Levels|log level]] and a file path, the Phidget library will automatically log any important Phidget events for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is important to enable logging &amp;#039;&amp;#039;&amp;#039;before&amp;#039;&amp;#039;&amp;#039; making any other calls to the Phidget library.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabber&amp;gt;&lt;br /&gt;
Python=&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
Log.enable(LogLevel.PHIDGET_LOG_INFO, &amp;quot;phidgetlog.log&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
Java=&amp;lt;syntaxhighlight lang=java&amp;gt;&lt;br /&gt;
Log.enable(LogLevel.INFO, &amp;quot;phidgetlog.log&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
C#=&amp;lt;syntaxhighlight lang=cSharp&amp;gt;&lt;br /&gt;
Log.Enable(LogLevel.Info, &amp;quot;phidgetlog.log&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
C=&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
PhidgetLog_enable(PHIDGET_LOG_INFO, &amp;quot;phidgetlog.log&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
JavaScript=&amp;lt;syntaxhighlight lang=javascript&amp;gt;&lt;br /&gt;
phidget22.Log.enable(phidget22.LogLevel.INFO, &amp;quot;logfile.log&amp;quot;); //not available client-side&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/tabber&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Custom Log Messages====&lt;br /&gt;
After logging has been enabled, you can choose to log your own custom messages.&lt;br /&gt;
&amp;lt;tabber&amp;gt;&lt;br /&gt;
Python=&amp;lt;syntaxhighlight lang=python&amp;gt;&lt;br /&gt;
Log.log(LogLevel.PHIDGET_LOG_INFO, &amp;quot;custom message&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
Java=&amp;lt;syntaxhighlight lang=java&amp;gt;&lt;br /&gt;
Log.log(com.phidget22.LogLevel.INFO, &amp;quot;custom message&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
C#=&amp;lt;syntaxhighlight lang=cSharp&amp;gt;&lt;br /&gt;
Log.WriteLine(Phidget22.LogLevel.Info, &amp;quot;custom message&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
C=&amp;lt;syntaxhighlight lang=c&amp;gt;&lt;br /&gt;
PhidgetLog_log(PHIDGET_LOG_INFO, &amp;quot;custom message&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-|&lt;br /&gt;
JavaScript=&amp;lt;syntaxhighlight lang=javascript&amp;gt;&lt;br /&gt;
phidget22.Log.log(phidget22.LogLevel.INFO, &amp;quot;custom message&amp;quot;); //not available client-side&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/tabber&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Log Entry Format===&lt;br /&gt;
Each log entry will have the following components:&lt;br /&gt;
&lt;br /&gt;
[[File:Logging_entrydescription.png|center|link=|700px]]&lt;br /&gt;
&lt;br /&gt;
====Log Levels====&lt;br /&gt;
In the code examples above, you may have noticed the &amp;#039;&amp;#039;INFO&amp;#039;&amp;#039; log level being referenced. There are six different log levels that are used to sort messages in terms of importance:&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin:auto;width:85%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Importance !! Log Level !! Description !! Notes &lt;br /&gt;
|-&lt;br /&gt;
| High || CRITICAL || A fatal error has occurred in the Phidget library and the program will be aborted. ||&lt;br /&gt;
|-&lt;br /&gt;
| || ERROR || An unexpected error has occurred which has not been handled. This will impact a user.|| Recommended for space-constrained systems.&lt;br /&gt;
|-&lt;br /&gt;
| || WARNING || An error has occurred that the library has handled. This should not impact a user. ||&lt;br /&gt;
|-&lt;br /&gt;
| || INFO || Information about the state of the program (e.g. attach/detach events, server connects/disconnects, etc.). || Recommended for all systems without space limitations.&lt;br /&gt;
|-&lt;br /&gt;
| || DEBUG || Do not use.||&lt;br /&gt;
|-&lt;br /&gt;
| Low || VERBOSE || Do not use. ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When setting a log level, all levels with higher importance will automatically be logged. For example, if the log level is set to &amp;#039;&amp;#039;WARNING&amp;#039;&amp;#039;, both &amp;#039;&amp;#039;ERROR&amp;#039;&amp;#039; and &amp;#039;&amp;#039;CRITICAL&amp;#039;&amp;#039; messages will also be logged.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is recommended to use &amp;#039;&amp;#039;INFO&amp;#039;&amp;#039; when possible, and &amp;#039;&amp;#039;ERROR&amp;#039;&amp;#039; on space-constrained systems.&lt;br /&gt;
&lt;br /&gt;
==Advanced Use==&lt;br /&gt;
===Log Rotation===&lt;br /&gt;
Log rotation is enabled by default. When the log file reaches 10MiB, the Phidget library will automatically archive the contents in a new file at the same location. The new file will be timestamped showing when the rotation occurred. &lt;br /&gt;
&lt;br /&gt;
[[File:Logging_logrotation.png|center|link=]]&lt;br /&gt;
&lt;br /&gt;
If the log file reaches 10MiB again, the previous archive will be deleted, and a new one will be created in its place. As a result of the default behavior, the maximum amount of space that log files will use is 20MiB.&lt;br /&gt;
&lt;br /&gt;
You can change the maximum log file size (from 32 KiB to 10 MiB) and the number of log archives to keep (up to 64) through the Logging API.&lt;/div&gt;</summary>
		<author><name>Lmpacent</name></author>
	</entry>
</feed>