Get Started With Seagence

Getting started with Seagence is very easy.

  1. Create a Seagence account
  2. Connect your application

That’s it. When defects occur Seagence will alert.


Create a Seagence account

Seagence works with Java 8 and above, Tomcat/Wildfly/Undertow/Jetty/Weblogic and any servlet container.

Click “START FREE TRIAL” button at the top right corner

  1. Register on
  2. Login with new root user name/password (Note down root user name which you will need at a later step).
  3. After successful login, go to Settings tab, click “Download SGAgent” to download
  4. In the same Settings tab, click “API Token” and copy displayed API Token.
  5. Follow instructions below.

Connect your Application

Step1: Unzip downloaded file to find sg-java-agent.jar. Copy the sg-java-agent.jar file into a directory of your choice.

Step2: Create an empty properties file in the same directory where sg-java-agent.jar is copied. Then copy the below properties into the file.

hostName=[Assign a name to machine/node where your application is running]
applicationName=[Name of the application being monitored]
userName=[Root user name you provided at the time of registration]
containerName=[Tomcat | Weblogic | Jetty | Undertow | use Undertow for Wildfly as well | AnyServletContainer for any other servlet container

apiToken=[API Token copied from Settings tab -> API Token]

Contents of a sample file are below.


Step3: Attach sg-java-agent to your application

Use below JVM options to attach sg-java-agent.jar to your application.

Add this to JAVA_OPTS.

For Example: -javaagent:C:/seagence/sg-java-agent.jar=”propertyfile=C:/seagence/”

For Docker Image

If you are using Docker image, add below instructions to your dockerfile after Step2 above. Below instructions are for Tomcat, so if you are using another application server, refer to your vendor’s documentation.

RUN mkdir -p /usr/local/tomcat/seagence
ADD /sg-java-agent.jar /usr/local/tomcat/seagence/sg-java-agent.jar
ADD / /usr/local/tomcat/seagence/
ENV JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/tomcat/seagence/sg-java-agent.jar=propertyfile=/usr/local/tomcat/seagence/"

With that setup completes. Bring your application up and start using. sg-java-agent will post collected monitoring data to SeagenceWeb in the background.


Get a feeling of how Seagence works

Having SGAgent attached, let’s see how Seagence works. Know that Seagence is not just an error tracking/monitoring tool. Seagence’s main feature is autonomous detection of probable defects and their root cause in realtime. While Seagence’s error tracking capabilities can be found on SeagenceWeb portal (Seagence automatically records all exceptions and errors thrown by your application, you don’t need to post them) here we will demonstrate Seagence’s main feature i.e. detecting defects in realtime. For this we will do a small exercise in Dev environment. Select a simple GET (or POST) operation in your application that invokes some business function. For example one that fetches and processes some data from DB (select a simple operation because you will need to invoke this operation a 100 times for Seagence to collect enough data. In production you will have huge number of users using the application, so data collection is not a problem in production).

Introduce a defect

The best way to get the hang of how Seagence works is by introducing a defect in the selected GET operation and see how Seagence detects it. We introduce the defect in dev environment only and will remove it after the exercise. To do that add below code either in your Controller class or any other class (before business rules/logic starts executing when the GET operation is invoked) as shown below.

Define a static field variable

     public static int counter = 0;

and then add these below lines at the start of the method body of Controller class or other class where business logic starts executing in the selected GET operation.

     if(counter == 10 || counter == 20 || counter == 30 || counter == 40 || counter == 50 || counter == 60 || counter == 70 || counter == 80 || counter == 90 || counter == 100) {
          throw new NullPointerException();

There is no rocket science here, we are just telling the selected GET operation to fail 10 times. Now invoke the operation few more than 100 times and we know that 10 of those invocations will fail.

Detecting the defect

Now that Seagence collected enough data it is time to create the baseline. Seagence automatically creates incremental baseline at regular interval. In this exercise, instead of waiting for Seagence to create the baseline, you create the baseline by login into SeagenceWeb, go to Baseline tab and click “Create Baseline”. At this time you will receive alert for failed invocations (one alert per failure cluster, with a count of failures. A cluster is a group of similar invocations), so now check your inbox. Also check Clusters tab on SeagenceWeb for more debug information.

Alert not received? Check if enough data is collected. Click “View Data” link in Baseline tab which will list amount of data collected per endpoint. Is the data size greater than 100 for our GET operation? If not invoke the operation few more times, create Baseline again and see that alert is sent for failed invocations.

You will find more debug information on SeagenceWeb, under Clusters tab.

Still have not received alert? You might need some help, please post your question to


Now let's dive little deeper

The earlier defect we introduced either results in HTTP 500 error status or uncaught exception. Other monitoring solutions can also detect such failures. However Seagence can also detect much difficult defects, for example the ones caused by swallowed or caught exceptions or ones disguised in 200 response codes. Now we will swallow the exception and see how Seagence detects it. To keep things simple let’s start afresh. Go to Settings tab on SeagenceWeb and delete all data by clicking “Delete Data” and restart your application. Application restart is necessary because when you “Delete Data”, some contextual information is also lost.

If you swallow the exception like below

   try {
     if(counter == 10 || counter == 30 || counter == 40 || counter == 50 || counter == 60 || counter == 70 || counter == 80 || counter == 90) {
          throw new NullPointerException();
   } catch(Exception exc){}

it will have no impact on your operation and the invocation will continue successfully. So allow the exception to make some impact on the request execution so that the request fails and then swallow it like below. This impact on the request execution is captured in Seagence’s ExecutionPaths. A swallowed exception leaves no trace in the log hence debugging a defect due to swallowed exception is much difficult.

   try {
     if(counter == 10 || counter == 30 || counter == 40 || counter == 50 || counter == 60 || counter == 70 || counter == 80 || counter == 90) {
          throw new NullPointerException();
     ... -> some business logic
   } catch(Exception exc){}

Now invoke the GET operation 100 times like earlier and see that Seagence finds defects caused by swallowed exceptions as well including root cause. For technical support please post your questions to

Note: Do not forget to remove the defect introduced. No information about the introduced defect is supplied to Seagence. Seagence autonomously detected this defect in realtime.


Say no to setting alert rules, thresholds and configuring exceptions

All this while notice that you have not input any knowledge or error configurations in Seagence like

1) Alert rule settings
2) Threshold settings
3) A suspicious exception configuration

Irrespective of any of this input, Seagence finds all failures and defects including defects due to swallowed exceptions, gracefully handled exceptions etc., with root cause in real time as they occur in production.