Logging Messages to aid debugging

You could write directly to a database table when you wanted to log something. This would work in all contexts:

message = "My latest log message"
severity = "info"
system.db.runPrepUpdate("INSERT INTO logging (Message,Severity) VALUES (?,?)",[message,info])

Probably best to write a function that wraps the database insert so you could just pass the message and severity to the function as arguments.

The only downside to this method is that in the client it takes a bit of time to run a database query due to network overhead but this is handled easily by wrapping the query with system.util.invokeAsynchronous, but you only need this if you need/want the client to be very quick.

Nick