Introduction
This page contains information that will help you diagnose problems with your Lasso 9 code.
Starting and Stopping Lasso Server
In Lasso 8.x there were command line executables that would start or stop Lasso Server. One of the tools would start Lasso Server in console mode, which would provide real-time feedback to the developer about Lasso processes. In Lasso 9 these tools have been replaced with new procedures and configuration.
In Lasso 9 by default Apache takes care of starting and stopping the lassoserver process. To run Lasso 9 in console or debug mode:
Edit your Lasso 9 Apache configupration file, and comment out the FastCGIServer directive (but NOT FastCgiExternalServer).
### This line will cause lassoserver to be started automatically when apache is started
# When running lassoserver manually, comment out this line
# FastCGIServer /usr/local/bin/lassoserver -initial-env LASSOSERVER_FASTCGIPORT=8999
Reload the Apache configuration.
sudo apachectl graceful
Start lassoserver in console or debug mode from the command line.
LASSO9_PRINT_FAILURES=1 sudo ~lasso/LassoExecutables/lassoserver
If you have installed Lasso 9 somewhere other than the default location, or connected to a different FastCGI port, then you need to specify these too. For example if you have a copy installed in your home directory and wanted to connect to FastCGI port 9001:
LASSO9_HOME=/home/username/lasso LASSOSERVER_FASTCGIPORT=9001 LASSO9_PRINT_FAILURES=1 ~username/lasso/LassoExecutables/lassoserver
Logging
Lasso 9 provides many logging options. Lasso can log events to its internal SQLite database, a text file in the Lasso directory, and to the console. In addition you can configure Lasso to write log files anywhere to the file system.
Note that the more detailed your logging preferences, and the more
destinations you log to, the slower Lasso will run. Although this may be useful in development or while troubleshooting and debugging, it is recommended to disable most or all of the logging options on production
sites.
To do this, go to Log Book -> Settings in the Lasso 9
admin. For optimal performance it is recommended to log Critical errors only to the Database only, and disable all other options.
SQLite Database
Lasso writes events to its internal SQLite database named lasso_logbook located in the Lasso directory within the directory named SQLiteDBs. You can view these databases at the Admin URL /lasso9/Admin/logbook or using any SQLite database tool. SQLite Database Browser is one such free and open source tool.
On Mac OS X the Lasso SQLite databases are located in /Library/Lasso/SQLiteDBs.
Text File Logging in the Lasso Directory
Lasso writes events to a text file named lasso_logbook.txt located in the Lasso directory.
Console
See the instructions for Starting and Stopping Lasso Server.
Interpreting the Lasso 9 Error Stack
The default Lasso "blue screen" from 8.5 is gone and has been replaced with a very plain error stack page. Here is an example of migrating code from Lasso 8.5 to Lasso 9.
Original Lasso 8.5 code working example:
[
if(action_param('session')=='start');
session_start(-name='cabbage',-expires=15,-CookieExpires=15);
var('fruit') = array;
session_addvar(-name='cabbage','fruit');
else(action_param('fruit'));
session_start(-name='cabbage',-expires=15,-CookieExpires=15);
$fruit->insert(action_param('fruit'));
else(action_param('session')=='end');
session_start(-name='cabbage',-expires=-999999,-CookieExpires=-999999);
session_end(-name='cabbage');
redirect_url(response_filepath);
/if;
]
[if(session_id(-name='cabbage') == '')]
<p><a href="[response_filepath]?session=start">start/load session</a></p>
[else]
<p><a href="[response_filepath]?session=end">end session</a></p>
<h3>Add a fruit to your session.</h3>
<ul>
[iterate(array('Santa Rosa plum', 'Jonagold apple', 'Avocado'),local('i'))]
<li><a href="[response_filepath]?fruit=[#i]">[#i]</a></li>
[/iterate]
</ul>
[/if]
<p>Session ID: [session_id(-name='cabbage')]</p>
<p>Session Fruits: [var_defined('fruit')?$fruit]</p>
The exact same code fails in Lasso 9 when the user clicks any fruit in the list (the list should not display anyway, which is another clue). Here is the resulting error stack:
An unhandled failure during a web request
Error Code: -9947
Error Msg: The variable fruit was not found
Error Stack:
8:2 //Library/WebServer/Documents/l9//_cookie.lasso
2:1 //Library/WebServer/Documents/l9//_cookie.lasso
85:12 web_response.lasso
182:2 error.lasso
73:3 web_response.lasso
184:19 web_response.lasso
604:17 web.lasso
182:2 error.lasso
603:2 web.lasso
247:16 fastcgi.lasso
182:2 error.lasso
241:2 fastcgi.lasso
465:37 fastcgi.lasso
The content of the error page is familiar. A brief description is followed by the error code, error message and the error stack. The error stack indicates in which file the error occurred (_cookie.lasso) and on line 8, position 2 of the file.
The variable fruit was not getting added to the session, which implies the session never started so that the variable could be added to it. Thus when we tried to add a fruit, we got the error message. In Lasso 9 non-existent parameters and variables are void, i.e., have no value, are not null, are not empty strings, and so on. They are truly nothing. But we can compare a void to a void, and that is how we can fix this code. Let's start with the logic around the variable fruit.
else(action_param('fruit'));
Change to:
else(action_param('fruit') != void);
That still loads the list and we should have a link to start a session. Aha! We missed a comparison.
[if(session_id(-name='cabbage') == '')]
Should be:
[if(session_id(-name='cabbage') == void)]
And now we can add fruit to our session.
Lasso 9 Source Code and Examples
LassoSoft provides a Subversion repository of much of its source code for Lasso 9. You can check out a working copy of the source code to your local development environment and refer to it for code samples, proper syntax and examples.
The repository is located at the following URL:
http://download.lassosoft.com/svn/lasso/lasso9_source
To do this, go to Log Book -> Settings in the Lasso 9 admin. I would recommend logging Critical errors to the Database (so you can view them in the Admin), and disable all other options.