Monday, January 01, 2007

Tracing deployed plugins

In a previous post I have explained how to use Cohatoe's debugging options (called Tracing in Eclipse) for getting more info about what goes on inside Cohatoe when Haskell functions are registered and called. This is useful when you are contributing an Eclipse extension and something goes wrong, so that your function call doesn't actually happen.

You can also use the same tracing options in an Eclipse installation where your plugins are deployed. This is in some respects a different situation, different from the debugging situation I have described. Your plugins may now reside in .jar archives, for instance, where they before had lived in project folders in the workspace, and that may have some unforeseen effects.

And there is another typical problem with deployed Eclipse installations. When you export a plugin, you have to declare, in the, which files should be exported and which not. You can find the in the Plugin Manifest editor, from the Build tab.

In the screenshot, you can see how this looks in my workspace for the Cohatoe examples. You see that the files needed only at development time (such as Eclipse's .project file of the .checkstyle configuration are not checked, but the files that we need to deploy, such as the plugin.xml or the object files, are checked. A typical case is where a developer first creates a project, later adds some files, such as icons or object files, forgets to check them in the, and then wonders why something doesn't work in the deployed version. To me at least, this happens all the time :-).

One way to detect such a problem, at least with object files contributed via Cohatoe, is to use tracing. In the post I mentioned above I have explained how the tracing output looks like. If an object file was missing, this would be reported in a line in the tracing output.

Now suppose you have some Eclipse installation, where Cohatoe is installed.

This is what a typical Eclipse installation looks like. The only thing that I have added is the .options file. Its content is quite simple:

# option for tracing calls to the Cohatoe server,
# including inits and function calls
de.leiffrenzel.cohatoe.server.core/logs = true
I have just copied it from the Cohatoe server core plugin. (You can add options for other plugins in here too, and get their tracing output too.) Note that I have switched the value to true; the original file has false in this place.

Now run Eclipse from the command line with the following options:
> cd C:\cohatoetest\eclipse
> eclipse -debug -consolelog
You get a console window where you will see the tracing output (and as a nice extra, you will also get the contents of the workspace log appended there, i.e. the output that ususally goes to yourWorkspaceLocation/.metadata/.log).

No comments: