• Anonymous
  • Login
  • Register
XPage Debug Toolbar

Owners Mark Leusink Category
Web Development Tools
Contributors - Platform
R 8.5.0
Downloads 801Download latest release Last Release Apr 25, 2012
Rating
(7 ratings)
Project Creation Jan 13, 2012
Status Active Short URL Not defined
Description XPage custom control that can be used for (debug) logging, viewing scope variables, basic profiling In Catalog
Yes


The XPage Debug Toolbar is a custom control that adds a toolbar to the top of your XPage. It shows you:

  • Personal log/ debug messages you've added in your code by using one of the log calls. You'll have no need for print() statements anymore! You'll be able to log messages from SSJS and Java (beans) code.
  • The contents of the various scopes (applicationScope, sessionScope, viewScope and requestScope)
  • A list of custom environment variables
  • A "timers" tab you can use for basic code profiling (see how fast your code is).
  • Tommy Valand's API Inspector

 

Note that the log/ debug messages are stored in the sessionScope, so they are unique to the current user and are stored when switching between pages. In the message tab you'll also find an "open in external window" link: this will open a separate XPage ("debugToolbarConsole") that you can leave open and that will automatically be refreshed showing the latest messages.

Messages can be added using one the following commands. The difference is in color coding. The "context" parameter is optional.

dBar.info(message:String, context:String);
dBar.warn(message:String, context:String);

dBar.debug(message:String, context:String);
dBar.error(message:String, context:String);

 

The toolbar also allows you to dump the contents of any variable to the messages tab using:

 

dBar.dump( anyObject );

Basic profiling using timers
I also added a "timers" tab to perform some basic profiling tasks on your code. You can add/ start and stop a timer by using the following commands:

dBar.startTimer( timerId:String );
dBar.stopTimer( timerId:String );

I extended the toolbar with stuff I also use regularly: lists of the contents of the various scopes (application, session, request, view), a list of variables always handy to have around, and Tommy Valand's API inspector. Inspiration for this came from Ferry Kranenburg's XPage Debug Custrom Control.

Improved object dumping
All variables from the various scopes are "dumped" in their respective tabs. This is done using a custom dumpObject function I've written. In most cases this function dumps more detailed information than the xe:dumpObject control from the Extension Library..
Usage and configuration
Including the toolbar is easy copy the following design elements to the application you'd like to use it in:
  • custom control ccDebugToolbar
  • (SSJS) script library xpDebugToolbar
  • XPage debugToolbarConsole (only required if you want to be able to "detach" the messages tab)
  • If you want to able to log from Java beans you need to copy two Java class files: com.debug.DebugToolbar and com.debug.util.JSFUtil. You also need to activate the Extension Library.
I'd recommend to always include the custom control and use the (custom) "load" property to indicate if it should be loaded or not. If set to false, nothing is rendered, but the xpDebugToolbar script library is included. This way all your log statements will not throw any errors (and won't do anything). The defaultCollapsed property can be used to set the default state of the toolbar. If collapse, only a small indicator is shown at the top of a page to show the full toolbar. The toolbar can be configured to collapse to the left or right of the screen using the collapseTo property.
Note that due to the order of events in XPages and custom controls, you can't add log messages to the beforePageLoad event.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



Projects can have short and readable URLs, e.g. http://mobilecontrols.openntf.org.

You can request a short URL to your project by sending a mail to support at openntf dot org. Put the word 'OpenNTF' somewhere in the subject.
Owners are the people with maximal rights. For example they can create releases and add more contributors.

In order to define multiple owners use "," (comma) as separator.

Because of data privacy you cannot lookup other people's names but you have to type them in.
Enter the contributors or owners here who you want to receive notifications and questions by email.

In order to define multiple owners use "," (comma) as separator.

Because of data privacy you cannot lookup other people's names but you have to type them in.
In addition to the owners additional OpenNTF contributors have to be listed here. Contributors don't have the same access rights as owners, e.g. they cannot create releases.

In order to define multiple owners use "," (comma) as separator.

Because of data privacy you cannot lookup other people's names but you have to type them in.
Enter a short description of the project here (up to 100 characters).

The short description shows up in the project UI and in some of the views.
In this field you should enter a more detailed description of your project.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.
A Catalog Release is for projects that are production ready and that are end-user "install friendly".

This property describes whether any release of this project has been added to the catalog.

Learn more about the catalog.