How to use TimeBasedTriggeringPolicy for the Crowd Data Center Application Logs

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

TimeBasedTriggeringPolicy is a triggering policy provided by the Apache Log4j library that we can customize the log output based on the date and time as per our requirement.

Crowd doesn't fully support TimeBasedTriggeringPolicy yet. This is because it requires a date pattern in the file name. Please see our feature request CWD-6212 - Crowd does not fully support TimeBasedTriggeringPolicy Gathering Impact  for more information. Feel free to use the below workaround in the meantime.

Environment

This has been tested on Crowd v5.2.3.

Solution

  • Ensure the Crowd service is stopped and take a backup of the installation directory if needed, just to be on the safe side.
  • Edit the below file:
/crowd-webapp/WEB-INF/classes/applicationContext-CrowdBootstrap.xml
  • Look for the parameter:
<property name="logFileName" value=
  • Update the parameter to the following and save the changes:
<property name="logFileName" value="atlassian-crowd.log.%d{yyyy-MM-dd-HH}"/>

  • Next, edit the file below: 
/crowd-webapp/WEB-INF/classes/log4j2.properties
  • Look for the references to these properties: 
appender.crowdlog.policies.size.type=SizeBasedTriggeringPolicy
appender.crowdlog.policies.size.size=20480KB
  •  Replace the above lines with the changes below and save the file.
appender.crowdlog.policies.time.type=TimeBasedTriggeringPolicy
appender.crowdlog.policies.time.interval=1
appender.crowdlog.filePattern=${sys:crowd.home}/logs/crowd-%d{yyyy-MM-dd}.log
appender.crowdlog.policies.time.modulate=true
  • Finally, start Crowd and application should come up.

     

(info)  Note: appender.crowdlog.policies.time.interval=1 defines a number of hours, so if you want to rotate the logs every 1 hour, set the value to 1.  Or as another example, if you want to rotate every 6 hours, then set the value to 6.


Last modified on Mar 12, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.