000015231 - AxM 6.X - Aserver hook logging example

Document created by RSA Customer Support Employee on Jun 14, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000015231
Applies ToRSA Access Manager 6.x
IssueAxM 6.1 - Aserver hook logging example
Resolution

In the example below exemplifies printing to the log when a certain amount of time is exceeded - for example, 5 seconds.

 

You could add a parameter  "cleartrust.aserver.hook_logging_enabled=true" to  determine when to trigger loging.

 

NOTE: This example is limited to logging, and not based on debug log levels.

 ============================================================================

//In aserver.conf add

//cleartrust.aserver.hook_logging_enabled=true

 

import java.util.Properties;

import java.util.Date;

import java.util.Calendar;

import sirrus.runtime.*;

import sirrus.util.hook.HookEvent;

import sirrus.util.hook.HookListener;

import sirrus.util.hook.HookListenerException;

import sirrus.util.hook.HookManager;

import sirrus.util.hook.RuntimeAPIHookEvent;

import sirrus.util.hook.TokenManagerHookEvent;

import sirrus.logging.LogEventDispatcher;

import sirrus.logging.common.GenericLogEvent;

 

               Properties cfg = HookManager.getConfigurationProperties(); 

                private boolean bLogging = false;             

                private final String HOOK_LOGGING_ON = "cleartrust.aserver.hook_logging_enabled";

 

                String logging = cfg.getProperty(HOOK_LOGGING_ON); 

                                if(logging != null && logging.equalsIgnoreCase("true"))

                                {

                                        bLogging = true;

                                }

                 timeStart = new Date();

 

                if(bLogging)

                {

                        logEvent("Starting hook " + timeStart ); 

                }

               

                // do the same for the end hook,  what ever format you want , also calculate the time spent in hook

 

 

 

 

public void logEvent(String eventMsg)

                {

                             GenericLogEvent event = GenericLogEvent.getGenericLogEvent(); 

                             event.setLogInfo("Authorize", eventMsg); 

                             LogEventDispatcher.getInstance().fireLogEvent(event);

                 }

Legacy Article IDa56886

Attachments

    Outcomes