Skip to content
Maurice Zeijen edited this page Mar 17, 2016 · 3 revisions

Requirements

You need Java 6 or later.

Getting Binaries

Binaries and dependency information for Maven, Ivy, Gradle and others can be found at bintray.org.

Example for Maven:

<dependency>
  <groupId>com.philemonworks</groupId>
  <artifactId>selfdiagnose</artifactId>
  <version>x.y.z</version>
</dependency>

Example for Gradle:

compile 'com.philemonworks:selfdiagnose:x.y.z'

Example for Ivy:

<dependency org='com.philemonworks' name='selfdiagnose' rev='x.y.z'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>

Registering the SelfDiagnose servlet

Register the 'com.philemonworks.selfdiagnose.SelfDiagnoseServlet' Servlet

Within a web.xml it looks like this:

<!-- SelfDiagnose - Servlet -->
<servlet>
	<servlet-name>SelfDiagnoseServlet</servlet-name>
	<display-name>SelfDiagnose</display-name>
	<servlet-class>
	  com.philemonworks.selfdiagnose.SelfDiagnoseServlet
	</servlet-class>
</servlet>

<!-- SelfDiagnose - Mapping -->
<servlet-mapping>
	<servlet-name>SelfDiagnoseServlet</servlet-name>
	<url-pattern>/selfdiagnose.html</url-pattern>
</servlet-mapping>

Configuring tasks

Registration of diagnostic task can be done directly in a configuration XML file or programmatically.

XML configuration

Create the file name selfdiagnose.xml and place it in a resources or source folder such that this resource can be found on the classpath.

<?xml version="1.0" ?>
<selfdiagnose
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://selfdiagnose.sourceforge.net/selfdiagnose-2.8.xsd">

  <tasks>
    <checksystemproperty property="java.version" />
  </tasks>
</selfdiagnose>

Programatically adding tasks

The 'com.philemonworks.selfdiagnose.Check' and 'com.philemonworks.selfdiagnose.Report' classes contain many static helper methods to register check and report tasks.

For example:

Check.directory(System.getProperty("user.dir"));

Report.properties(System.getProperties());

It is also possible register you own custom tasks:

MyCustomCheckTask myTask = new MyCustomCheckTask();
SelfDiagnose.register(myTask);

Running tasks and view the report

The following request to the SelfDiagnoseServlet will run the diagnostic tasks and return an HTML page showing the results.

http://{host}:{port}/{your context}/selfdiagnose.html

By default this will return the HTML report. To get a JSON or XML response you can use the 'format' query parameter:

JSON

http://{host}:{port}/{your context}/selfdiagnose.html?format=json

XML

http://{host}:{port}/{your context}/selfdiagnose.html?format=xml