<p style="margin-left: 3.5em;">'''Other *nix'''<br/>For other versions of Unix, use either one of the above options and simply alter <tt>-agentpath:$YJP_HOME/bin/os-arch/libyjpagent.so</tt> so that <tt>$YJP_HOME/bin/os-arch/libyjpagent.so</tt> points to the YourKit Agent library for your platform.</p>

−

<p style="margin-left: 3.5em;">For other versions of Unix, use either one of the above options and simply alter <tt>-agentpath:$YJP_HOME/bin/os-arch/libyjpagent.so</tt> so that <tt>$YJP_HOME/bin/os-arch/libyjpagent.so</tt> points to the YourKit Agent library for your platform.</p>

+

<ol start="6">

<ol start="6">

<li>Locate and open the file <tt>lib/java6-server.profile</tt>. Towards the bottom of that file, there will be a section for ''bootdelegation''. Add the following value to that section, <tt>com.yourkit.*,\</tt><br/>

<li>Locate and open the file <tt>lib/java6-server.profile</tt>. Towards the bottom of that file, there will be a section for ''bootdelegation''. Add the following value to that section, <tt>com.yourkit.*,\</tt><br/>

To enable an Equinox console, you need to set a framework property, like this:

osgi.console=2402

identifying the port to use.

In the case of the user region, add this property to the file config/org.eclipse.virgo.kernel.userregion.properties. In the case of the kernel region, add this property to the file lib/org.eclipse.virgo.kernel.launch.properties.

You can even enable an Equinox console in both regions at once, using two different ports of course.

To use the console, telnet in:

> telnet localhost 2402

The most useful commands are ss to list all bundles, bundle <n> to display information about the bundle with bundle id <n>, and help to see other commands.

When running in the user region, the Virgo shell commands are offered via the vsh command. Type vsh help to see a list of the shell commands available.

Precision Debug logging

It is possible to turn on logging at various levels for specific classes (loggers) in Virgo. We illustrate this with a FileSystemCheckerdebug trace, which is part of the HotDeployer system.

In serviceability.xml in the config directory simply add the following:

which is pretty verbose, so be aware that the log file may become quite large very quickly. In the standard serviceability.xml file the appenders used here write to "rolling log files" which are based upon size; so the total amount of logged information is bounded, though the log you choose can be swamped with information from one source.

The serviceability.xml file is just a logback configuration file, and all the Logback functionality is available. For more information see the Logback configuration on-line documentation.

Entry and Exit tracing

In the default serviceability.xml file the root logging level is INFO. This is reasonable: if a log entry is made at INFO level, one expects this to appear in the log under normal circumstances.

Medic (one of the Virgo repositories) is designed to set up logging, tracing and dumping, for use by the rest of the code, and achieves this partly by weaving in aspects that perform tracing at the entry and exit points of methods. These aspects are woven into the rest of the code so that they don't have to code them themselves.

The entry and exit level tracing aspects are carefully woven into the kernel and the server code (web) to avoid the logging code itself (recursion) and the low-level utility functions (util and osgi-extensions).

It traces entry and exit points at two levels: DEBUG for all public methods and TRACE for all other methods (package private and private). 'Getter' and 'Setter' methods (those beginning with get and set) are not traced at any level.

So, to see these entries you need to set the logging level to DEBUG or higher for the areas you are interested in.

You will see entries in the serviceability/log/log*.log files like this:

where the entry and exit points are marked with > and < respectively, with the full class names of the method and its parameters supplied.

It is arranged that any exit from a method will be traced if its entry is, even if that was the result of an exception, so the entry and exit lines should always pair.

Profiling

We use YourKit for profiling Virgo. The setup is simple and apart from adding the appropriate JVM options (described on the YourKit site) to JAVA_OPTS, all that is necessary is to add com.yourkit.* to the org.osgi.framework.bootdelegation property in lib/java6-server.profile. Note that YourKit has a default filter which excludes org.eclipse.*, so if you would like to profile the internals of Virgo then you'll need to disable this filter.

For a detailed break down of this process, please see the section below related to your operating system.

Linux / Unix

Install YourKit to your PC. For the purposes of this guide, YourKit has been installed into /opt/yjp-9.5.4. You do not have to install YourKit into this directory to enable profiling with Virgo. It is just used as an example.

Locate the directory where you have installed Virgo, create the following file and open it: bin/setenv.sh

Edit the file bin/setenv.sh and add two shell variables: YJP_HOME and JAVA_OPTS.

Other *nixFor other versions of Unix, use either one of the above options and simply alter -agentpath:$YJP_HOME/bin/os-arch/libyjpagent.so so that $YJP_HOME/bin/os-arch/libyjpagent.so points to the YourKit Agent library for your platform.

Locate and open the file lib/java6-server.profile. Towards the bottom of that file, there will be a section for bootdelegation. Add the following value to that section, com.yourkit.*,\

This means that the YourKit profiler has been enabled for the Virgo installation. If you do not see this line as the first line of the console output, please check the edits made to the bin/setenv.sh file and to the lib/java6-server.profile file in the previous two steps.

Start the YourKit application.

If you would like to profile the internals of Virgo, go to the Settings menu and select Filters. Then scroll down the list till you see the entry for Eclipse. Unselect the checkbox next to that entry and click the OK button. Note You only need to perform this step once.

Look at the Monitor Local Applications panel, it should now contain an entry for the Eclipse Virgo server, labeled as Launcher. Click the link to start profiling Virgo and any bundles deployed to the server.

Windows

Install YourKit to your PC. For the purposes of this guide, YourKit has been installed into C:\Program Files\YourKit Java Profiler 9.5.4. You do not have to install YourKit into this directory to enable profiling with Virgo. It is just used as an example.

Right click on My Computer and go to Properties. Click the Advanced tab and then the Environment button.

Add a System Variable called YJP_HOME and set its value to the location where YourKit was installed. For this example, that is C:\Program Files\YourKit Java Profiler 9.5.4.

Edit the Path system variable and append one of the following %YJP_HOME%\bin\win32 for 32-bit Windows systems or %YJP_HOME%\bin\win64 for 64-bit Windows systems.

Locate the directory where Virgo is installed and create a file called bin/setenv.bat.

Edit the file bin/setenv.bat and add a shell variable called JAVA_OPTS. Set the value to the following.

This means that the YourKit profiler has been enabled for the Virgo installation. If you do not see this line as the first line of the console output, please check the edits made to the bin/setenv.sh file and to the lib/java6-server.profile file in the previous two steps.

Start the YourKit application.

If you would like to profile the internals of Virgo, go to the Settings menu and select Filters. Then scroll down the list till you see the entry for Eclipse. Unselect the checkbox next to that entry and click the OK button. Note You only need to perform this step once.

Look at the Monitor Local Applications panel, it should now contain an entry for the Eclipse Virgo server, labeled as Launcher. Click the link to start profiling Virgo and any bundles deployed to the server.