14.1 Configuring and Leveraging log4j
Key Takeaways
IdentityIQ logging is configured in WEB-INF/classes/log4j2.properties using Log4j 2 logger, level, and appender definitions.
A logger is declared with a pair of lines, logger.<id>.name and logger.<id>.level, and the most specific matching logger wins.
The console logConfig command reloads log4j2.properties, and the Debug pages' Logging page shows or changes the path to the properties file.
Rules should log through a named logger at debug level so logging can be turned on and off per rule without code changes.
Only WARN, ERROR, and FATAL events are also stored in the database Syslog table; debug output goes only to the log appenders.
Configuring and Leveraging log4j
Objective 6.1 is configure and leverage log4j. Most IdentityIQ troubleshooting starts by making the right component talk more, so you need to know where logging is configured, how to change it safely, and how to read what comes back.
Where Logging Is Configured
IdentityIQ uses Apache Log4j 2. Its configuration file is log4j2.properties, in identityiq_home/WEB-INF/classes. SailPoint's own instructions refer to it, for example: "add these entries to the log4j2.properties file" to troubleshoot Rapid Setup.
The file has three kinds of definitions:
| Concept | Meaning |
|---|---|
| Logger | A named category, usually a Java package or class such as sailpoint.api.Aggregator, with a level |
| Level | TRACE, DEBUG, INFO, WARN, ERROR, FATAL. A logger emits events at its level and above. |
| Appender | Where events go: the console or stdout (captured by the application server log, such as Tomcat's), a rolling file, or other targets |
Loggers inherit from their parent package and ultimately from the root logger. The most specific logger wins, so you can set sailpoint to WARN and one class to DEBUG.
Turning On Debug Logging
The documentation's Rapid Setup example shows the Log4j 2 properties syntax, a pair of lines per logger:
logger.rapidsetup.name=sailpoint.rapidsetup
logger.rapidsetup.level=debug
logger.rapidsetuplib.name=sailpoint.workflow.RapidSetupLibrary
logger.rapidsetuplib.level=debug
The part after logger. (for example, rapidsetup) is just an identifier that ties the two lines together. It must be unique in the file.
Categories Worth Knowing
| Problem | Useful logger |
|---|---|
| Aggregation and correlation | sailpoint.api.Aggregator and the connector's package |
| Identity refresh | sailpoint.api.Identitizer |
| Workflow execution | sailpoint.api.Workflower |
| Plan compilation and provisioning | sailpoint.provisioning.PlanCompiler, sailpoint.api.Provisioner |
| Rapid Setup | sailpoint.rapidsetup, sailpoint.workflow.RapidSetupLibrary |
| Your own rules | Your own named logger (below) |
Specific tasks sometimes need their own entries. The documentation, for example, tells you to add a logger entry to enable logging for the Application Builder task.
Appenders and Output
The appenders in log4j2.properties decide where messages go. A console (stdout) appender sends output to the application server's own log. A file appender writes to a separate IdentityIQ log file that can rotate by size or date. Each logger can point to one or more appenders, and output also flows up to the root logger's appenders unless additivity is turned off. When you cannot find your debug output, check three things: that the logger's level is low enough, that it reaches an appender, and that you are reading the log file on the host that actually ran the work.
A useful pattern is a dedicated file appender for a project's custom rules. Custom output then does not get lost among product messages, and it can be collected separately.
Reloading Without a Restart
- Console: the
logConfigcommand reloads the Log4j configuration fromlog4j2.propertiesinto the running instance. - Debug pages: the Logging page shows, and can change, the path to the Log4j properties file the server uses.
- Import files: an import file's
ImportActioncan includelogConfig(section 3.1).
In a cluster, each host has its own copy of log4j2.properties and reloads independently. Change and reload it on the host that runs the work you are debugging, or on all hosts.
Logging From Rules and Workflows
Every rule gets a log variable (section 9.2). For long-lived code, use a named logger so the rule's output can be switched on or off in log4j2.properties alone:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Log rlog = LogFactory.getLog("acme.rules.HRCorrelation");
if (rlog.isDebugEnabled()) {
rlog.debug("Correlating account " + account.getIdentity());
}
logger.acmehr.name=acme.rules.HRCorrelation
logger.acmehr.level=debug
In workflows, the Standard Workflow Handler's log method writes to Log4j with a level, and the trace variable prints step-by-step execution (section 10.3). The documentation suggests println only for temporary debugging, removed before production.
Good Practice
- Debug is expensive. Verbose logging on aggregation or refresh classes can slow tasks and fill disks. Turn it on for the shortest time on the host doing the work, then set it back.
- Guard expensive messages with
isDebugEnabled(). - Never log secrets, such as passwords, tokens, or full ResourceObjects with sensitive attributes.
- Keep
log4j2.propertiesin the build (section 3.1). Each environment may need different levels and appenders. - Know what reaches the database. Only WARN, ERROR, and FATAL events are stored in the Syslog table (section 14.2). DEBUG and INFO go only to the appenders.
Worked Troubleshooting Example
Accounts from a new JDBC application arrive, but several correlate to the wrong identities.
- Add DEBUG loggers for
sailpoint.api.Aggregatorand the custom correlation rule's named logger. - Run
logConfigin the console on the task host. - Re-aggregate a small test set, for example by filtering the source.
- Read the log: which correlation key and value did the rule return for each account?
- Fix the rule, set the loggers back to WARN, and run
logConfigagain.
A developer adds a DEBUG logger to log4j2.properties on the task server and needs it to take effect without restarting the application server. What should the developer do?
Run the logConfig command in the IdentityIQ console on that server.
Run iiq schema to regenerate the configuration.
Import init.xml again.
Clear the Hibernate cache with clearCache.
Which pair of lines correctly sets DEBUG logging for the class sailpoint.api.Identitizer in log4j2.properties?
log4j.logger.Identitizer=DEBUG, file
sailpoint.api.Identitizer.level=debug only
logger.ident.name=sailpoint.api.Identitizer and logger.ident.level=debug
rootLogger.name=sailpoint.api.Identitizer and rootLogger.level=debug
A rule logs detailed DEBUG messages, but none appear in Advanced Analytics Syslog search. Why?
Syslog only stores messages from workflows.
Only WARN, ERROR, and FATAL events are stored in the Syslog table; lower levels go only to the Log4j appenders.
The rule must be of type Syslog.
Syslog search only shows events from the UI host.
Why is it better for a custom rule to log through its own named logger rather than printing with System.out.println?
Named loggers run faster than any other Java code.
println is blocked by the Rule Editor.
Named loggers automatically send email alerts.
A named logger's level can be switched in log4j2.properties without changing the rule, and its output goes to the configured appenders.
Sections you finish are checked off in the contents.