How to write logs in different file except from workflow trace file

Which IIQ version are you inquiring about?

[IIQ8.3]

Please share any other relevant files that may be required (for example, logs).

[Please inse
Sailpoint.log (8.7 KB)
rt files here, otherwise delete this section]

Share all details about your problem, including any error messages you may have received.

[I want to print log statement for test rule which I have created from backend.The logs should not print in log file where the workflow trace logs is present, rule logs should print in another file. How can we achieve it in IIQ? The attached log file is for workflow trace]

Hi @Shalaka_Gawande,

you can use the logger of log4j. In this file you add the logger and the appender. The logger define the property of the file(name, path, rotacion, etc…) and the appender define the level of the logs that you print and the name of logger.

Example

Appender

appender.ruleutility.type=File
appender.ruleutility.name=ruleutility
appender.ruleutility.fileName=/opt/tomcat/logs/Rule.log
appender.ruleutility.filePattern=/opt/tomcat/logs/Rule.%i.log
appender.ruleutility.layout.type=PatternLayout
appender.ruleutility.layout.pattern=%d{ISO8601} %5p %t %c{4}:%L - %m%n
appender.ruleutility.policies.type=Policies
appender.ruleutility.policies.size.type=SizeBasedTriggeringPolicy
appender.ruleutility.policies.size.size=100MB
appender.ruleutility.strategy.type=DefaultRolloverStrategy
appender.ruleutility.strategy.max=5

Logger

logger.ruleutility.name=com.ig.Rule
logger.ruleutility.level=debug
logger.ruleutility.appenderRef.ruleutility.ref=ruleutility
logger.ruleutility.additivity=false

this configuration will generate a file called Rule.log into /opt/tomcat/logs and every time the file size group up 100Mb starts the rotation.

In you rules everytime you use this logger:
Log log = LogFactory.getLog("com.ig.Rule");
the logs will be printed into the new file.

2 Likes

It is working. Thank You so much @enistri_devo .

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.