Using the Console View [edit]

This page describes how to use the Console View for the Aptana JavaScript debugger.

Contents

Introduction

Use the Console View (shown below) to find out the value of a variable or object at a given time. The value will be written out to the Console.

Image:consoleView.png

Instructions

This section describes how to do common logging tasks.

Adding a new log message to the Console View

You will need to have the debugger set up to run to use the Console View. See Running the debugger for help.

To add a new log message to the Console View:

  1. Open your file in the appropriate Aptana Editor.
  2. Navigate to the function or place in your code where you want to add the log message.
  3. Add the following line of code to your code: aptana.log(logMessage);. logMessage should be the message that you want to be printed out to the Console View. (e.g. aptana.log("Now is " + tDate);).
  4. Click the Debug button Image:iconDebug1.png to run/debug your code in your browser.

The log entry that you added will print out to the Console View as it is executed. Click the Terminate button Image:iconTerminate.png to stop the execution of your code.

Adding other log messages

window.dump()

In addition to aptana.log, you can also use window.dump(), to print out to the console. The window.dump() command is compatible with many currently popular JavaScript toolkits.

aptana.trace()

Use the aptana.trace() command to generate a stack trace in the Console.

Related Topics