Server | Version 4

Sophora Server: Activating the profile log

The Sophora Server can write detailled profile logs tracking all the requests and their durations

What is the profile log?

The profile log prints every single request to the servers content manager (without payload) including the duration it took to perform the request.

This does not cover direct requests to Solr or the Content-API (though) they might trigger requests to the content manager themselves.

When should I enable the profile log?

Profiling might easily generate a gigabyte of log per day. So you should just activate it if you're about to investigate those log files.

Profile log however helps to track slow requests or figure out which requests are received generally.

How to activate the profile log

The profile log is enabled via the logback.xml file. To generally enable it this single line is sufficient:

<logger name="com.subshell.sophora.commons.profile.LoggingProfiler" level="DEBUG" />

This will make the profile logger append to your root definitions and most likely write to your general log file. If you'd prefer to write your profile log information to a different logfile you might want to write this:

<appender name="profile" class="ch.qos.logback.core.rolling.RollingFileAppender">
 <File>${sophora.home}/logs/profile.log</File>
 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
 <fileNamePattern>${sophora.home}/logs/profile.%d{yyyy-MM-dd}.log</fileNamePattern>
 <maxHistory>7</maxHistory>
 </rollingPolicy>
 <encoder>
 <pattern>[%d{ISO8601}, %-5p] [%t] [IP: %X{IP}] [UUID: %X{uuid}] [SOPHORA_ID: %X{sophora_id}] [USER: %X{user}] %m%n</pattern>
 </encoder>
</appender>

 <logger name="com.subshell.sophora.commons.profile.LoggingProfiler" level="DEBUG" additivity="false">
 <appender-ref ref="profile" />
</logger>

See also the list of useful logging configurations.

Last modified on 10/16/20

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.

Icon