Oftentimes, it's difficult to figure out which SailPoint class to enable logging on when debugging a rule.
Plus turning on logging for a connector in order to debug a rule, has the added effect of turning on all other logging
statements for the connector as well which can make it difficult to isolate the log statements for your rule.
Here is a trick to do your own per-rule custom logging:
1. Make sure to import the apache log4j Logger object
import org.apache.log4j.Logger;
2. Create a custom logger in your rule or workflow code:
Logger mylogger = Logger.getLogger("com.yourcompany.projectname.FinanceCorrelationRule ");
3. Use this logger object for all your logging in the rule:
mylogger.debug("This is a debug message"); mylogger.info("This is an info message");
4. Using your log4j.properties file, control logging per rule by enabling or disabling logging:
log4j.logger.com.yourcompany.projectname.FinanceCorrelationRule =<loglevel>
Glad to hear. It's been working well for us so far. It's nice to be able to focus in on a specific step and/or look at things at a higher level without having to do anything crazy implementation wise.
Joseph,
Please ignore my above question as I checked my log4j.properties file and found that somehow I had removed the logger defined for the Rule I mentioned above. That was the reason it wasn't logging.
-Amit
Will this work in 7.2p2?
I am getting No Serializer registered for class
An unexpected error occurred: sailpoint.tools.xml.ConfigurationException: No serializer registered for class class org.apache.log4j.Logger
sailpoint.tools.xml.ConfigurationException: No serializer registered for class class org.apache.log4j.Logger
at sailpoint.tools.xml.XMLObjectFactory.toXml(XMLObjectFactory.java:285)
at sailpoint.tools.xml.BuiltinSerializers$MapSerializer.serializeToElement(BuiltinSerializers.java:975)
at sailpoint.tools.xml.UnwrappedObjectSerializer.serializeToElement(UnwrappedObjectSerializer.java:43)
at sailpoint.tools.xml.AnnotationSerializer.serializeToElement(AnnotationSerializer.java:557)
at sailpoint.tools.xml.UnwrappedObjectSerializer.serializeToElement(UnwrappedObjectSerializer.java:43)
at sailpoint.tools.xml.AnnotationSerializer.serializeToElement(AnnotationSerializer.java:557)
at sailpoint.tools.xml.XMLObjectFactory.toXml(XMLObjectFactory.java:287)
at sailpoint.tools.xml.XMLObjectFactory.toXml(XMLObjectFactory.java:271)
Are you backgrounding your workflow (i.e. is it stopping because of a background step, wait step or because you are filling in a workitem?
It could be that there is no defined serializer for the apache logger object, and therefore, we cannot serialize it when we background the workflow.
Hi all,
For 8.0 you can use the below 2 lines for log4j2.properties and the commented line is for the older version (log4j.properties)
logger.sp_webservices.name=sailpoint.server.InternalContext
logger.sp_webservices.level=debug
#log4j.logger.sailpoint.server.InternalContext=debug
Using this you can directly use log.info or log.debug in the workflow and rules.
-Melanie
Does this assume we also import the apache class and create a variable "log" in our code, or is the log variable accessible by all workflows?
The log variable is accessible by all workflows, but if it does not work set the trace variable in the workflow to true