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">
 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
 <pattern>[%d{ISO8601}, %-5p] [%t] [IP: %X{IP}] [UUID: %X{uuid}] [SOPHORA_ID: %X{sophora_id}] [USER: %X{user}] %m%n</pattern>

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

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.