How To
ForgeRock Identity Platform
ForgeRock Identity Cloud
How do I enable debug logging and log rotation for the Java Remote Connector Server (RCS)?
The purpose of this article is to provide information on enabling debug logging and log rotation for the Java® RCS in ForgeRock Identity Cloud and IDM.
Overview
By default, logging is not enabled for the Java RCS. Additionally, log files are not set to rotate by default, which means they will grow in size indefinitely when logging is enabled.
If you want to enable logging for the Java RCS, it is strongly recommended that you also configure the log files to rotate as described in this article.
Debug Logging
You can enable debug logging as follows:
- Edit the logback.xml file (which is located in the /path/to/openicf/lib/framework/ directory) and uncomment the following section:<logger name="org.identityconnectors.framework.impl.api.LoggingProxy" level="DEBUG" additivity="false"> <appender-ref ref="TRACE-FILE"/> </logger>
- Restart the RCS:$ /path/to/openicf/bin/ConnectorServer.sh /runThe debug logs will be written to the ConnectorServer.log (located in the /path/to/openicf/logs directory).
Rotating Log Files
You can configure the RCS to rotate log files as follows:
- Edit the logback.xml file and replace the following section (appender class:
ch.qos.logback.core.FileAppender
for the ConnectorServer.log file):<appender name="SERVER-FILE" class="ch.qos.logback.core.FileAppender"> <file>logs/ConnectorServer.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logs/ConnectorServer-%d{yyyyMMdd}.log</fileNamePattern> </rollingPolicy> <encoder> <pattern>%date{"MMM dd, yyyy h:mm:ss a"} %-5level %logger{35}: %msg %n</pattern> </encoder> </appender>With this section:<appender name="SERVER-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>logs/ConnectorServer.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logs/ConnectorServer-%d{yyyyMMdd}.log</fileNamePattern> <!-- keep 30 days of logs capped at 1GB total size --> <maxHistory>30</maxHistory> <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> <encoder> <pattern>%date{"MMM dd, yyyy h:mm:ss a"} %-5level %logger{35}: %msg %n</pattern> </encoder> </appender>Where:- The appender class is changed to
ch.qos.logback.core.rolling.RollingFileAppender
to rotate the logs. - The
maxHistory
andtotalSizeCap
properties are added to ensure old logs are removed. This example configures them so that 30 days of logs are kept, capped at 1GB in size, but you can set them as needed for your environment.
- The appender class is changed to
- Restart the RCS:$ /path/to/openicf/bin/ConnectorServer.sh /run