Skip to content

Instantly share code, notes, and snippets.

@rtfmoz2
Last active March 20, 2024 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtfmoz2/25eefb1323f5d60e15c5071830332ae8 to your computer and use it in GitHub Desktop.
Save rtfmoz2/25eefb1323f5d60e15c5071830332ae8 to your computer and use it in GitHub Desktop.
Logging with OGNL on Ping 11.3
// OGNL logging
// Use the logging classes to output messages from OGNL processing
// Generally used for testing script behaviour and input values
#log = @org.apache.commons.logging.LogFactory@getLog("com.pingidentity.ognl.logger"),
// log a message
#log.debug("Your log messages here"),
// log a multiline message
#log.debug("Send + "\r" + a + "\r" + Multiline + "\r" + "Log" + "\r" + "Entry"),
// log list data
#listdata = { "john", "jack", "sonny", "paul" },
#loglist = "List Entries",
#listdata.{ #item = #this, #loglist = #loglist + "\r" + #item },
#log.debug(#loglist),
// log json data
#gson=new com.google.gson.Gson(),
#jsonParser = new org.json.simple.parser.JSONParser(),
#jsondata = "{ \"details\" : { \"name\" : \"John\", \"surname\" : \"Smith\" , \"address\" : { \"number\" : \"21\", \"street\" : \"jump\", \"street_type\" : \"street\" } } }",
#log.debug("Log JSON Data" + "\r" + #jsonParser.parse(#jsondata))
// log request headers (OGNL in issuance criteria)
#objReq = #this.get("context.HttpRequest").getObjectValue(),
#headers = #objReq.getHeaderNames(),
#reqhdrs = "Request Headers",
#headers.{ #hdr = #this, #reqhdrs = #reqhdrs + "\r" + #hdr.toString() + " = " + #objReq.getHeader( #hdr.toString() ) },
#log.debug(#reqhdrs + "\r")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment