AgileApps Support Wiki Pre Release

Difference between revisions of "Debug Log"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 9: Line 9:


===Adding entries to the Debug Log===
===Adding entries to the Debug Log===
Use [[Utility_Calls#debug|Functions.debug]] statements in your classes to add entries to the Debug Log.


That Function adds statements at the ''INFO'' severity level. To see those statements in the Debug Log, make sure that the "recording level is set to that level, or lower. You can also use the [{{DOCHOST}}/javadocs/com/platform/api/Logger.html Logger] functions to add messages at specified severity levels, and to add an additional "type" parameter you can use to filter the log, later.
To add statements to the log, use the [{{DOCHOST}}/javadocs/com/platform/api/Logger.html Logger] utility class.
 
By default, messages at the INFO severity level are logged, so general practice is to code your debug statements like this:
:<syntaxhighlight lang="java" enclose="div">
Logger.info("{ClassName} NN. Your message.", "category");
<syntaxhighlight>
 
{{Tip|To make it easier to match log messages to your code, add an identifying number. (If you're debugging multiple classes, it can help to add the Class name, as well. Then, you'll be able to get to the source straight away.}}
 
:;Considerations:
::* The category value can be used to filter records in the Debug Log. So make it something that will help to filter things, later. (The category is not shown in the default Debug Log view, but you can [[Views#Edit_this_View|Edit the View]] to make it visible, and use it for filtering.)
::* The APIs take Java objects (not platform [[Objects]]), as well as Strings. If you use a Java object, make sure the <tt>toString()</tt> method returns a useful value. (That's what will appear in the log.)
::* For large applications, it may be desirable for administrators to have a standard set of messages that are always going into the log. In that case:
::** Use <tt>Logger.info(msg, category)</tt> for those messages.
::** Use <tt>Logger.debug(msg, category)</tt> for application debugging.
::** Then, since the severity levels running from lowest to highest, are: Trace, Debug, Info, Warn, Error, Fatal, normal operations will only see the Info messages.
::** To store debugging messages, set the recording level to Debug in the [[Developer Configuration]].


''Learn more:''
''Learn more:''
:* Change the recording level for messages in [[Developer Configuration]]
:* Change the recording level for messages in [[Developer Configuration]]
:* [[Java_API:Utility#debug|debug]] statement
:* [[Java_API:Utility#debug|debug]] statement
{{Note|The deprecated [[Utility_Calls#debug|Functions.debug]] can still be used to add entries to the Debug Log, for a time. That function adds statements at the ''INFO'' severity level.}}


===Controlling Severity-Level Visibility===
===Controlling Severity-Level Visibility===

Revision as of 00:06, 5 October 2011

Designer > Global Resources > Debug Log

About the Debug Log

Working with the Debug Log

To work with the debug log, you need either of these permissions:

Adding entries to the Debug Log

To add statements to the log, use the Logger utility class.

By default, messages at the INFO severity level are logged, so general practice is to code your debug statements like this:

<syntaxhighlight lang="java" enclose="div">

Logger.info("{ClassName} NN. Your message.", "category"); <syntaxhighlight>

Thumbsup.gif

Tip: To make it easier to match log messages to your code, add an identifying number. (If you're debugging multiple classes, it can help to add the Class name, as well. Then, you'll be able to get to the source straight away.

Considerations
  • The category value can be used to filter records in the Debug Log. So make it something that will help to filter things, later. (The category is not shown in the default Debug Log view, but you can Edit the View to make it visible, and use it for filtering.)
  • The APIs take Java objects (not platform Objects), as well as Strings. If you use a Java object, make sure the toString() method returns a useful value. (That's what will appear in the log.)
  • For large applications, it may be desirable for administrators to have a standard set of messages that are always going into the log. In that case:
    • Use Logger.info(msg, category) for those messages.
    • Use Logger.debug(msg, category) for application debugging.
    • Then, since the severity levels running from lowest to highest, are: Trace, Debug, Info, Warn, Error, Fatal, normal operations will only see the Info messages.
    • To store debugging messages, set the recording level to Debug in the Developer Configuration.

Learn more:

Notepad.png

Note: The deprecated Functions.debug can still be used to add entries to the Debug Log, for a time. That function adds statements at the INFO severity level.

Controlling Severity-Level Visibility

Debug messages have different severity levels. In the Developer Configuration settings, you can specify which severity levels are recorded in the log.

Viewing the Debug Log

  1. Visit Designer > Global Resources > Debug Log
    Debug Log entries are displayed in a View.
  2. Use standard Searching and Filtering operations to determine which records are displayed.

Clearing the Debug Log

  1. Visit Designer > Global Resources > Debug Log
  2. Click [Clear Debug Log]