I'm trying to figure out if there is a way limit the size of log files within the logback.xml configuration file.

I've reviewed the SDL documentation, which points me to the official documentation (here), which suggests adding the following:


But after restarting the services, I can see my file has grown more than I've configured. Does anyone have an example of their logback.xml showing a working / restricted files?

  • I think your link is broken and should go to logback.qos.ch (without the www) Commented Mar 6, 2013 at 8:09
  • @JonathanWilliams - if the http is removed the link is removed - issue in SO
    – johnwinter
    Commented Mar 6, 2013 at 15:59
  • I think it needs the 'http' but not the 'www'. Glad it's now working! Commented Mar 6, 2013 at 16:28
  • Can we even keep log files rolling in logs folder as an addition to limiting each log file's mail?
    – Guest19876
    Commented Dec 5, 2013 at 5:02
  • Fixed link... it needed the www removing, not the http. Jonathon - you do know you can just edit a question to fix stuff like that? Commented Jan 13, 2017 at 18:31

2 Answers 2



The following XML is also given on the logback site. This uses the RollingFileAppender and suggests that the 'maxFileSize' element needs to be inside a 'triggeringPolicy':

  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">

    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">

    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>

  <root level="DEBUG">
    <appender-ref ref="FILE" />

The following information is also given on the site too:

Specified number is not in proper int form, or not expected format.

When you specify the MaxFileSize to be used by the SizeBasedTriggeringPolicy, logback expects a rather precise format:

The number has to be an integer You can add 'KB', 'MB' or 'GB' after the number. Here are some correct values: 500KB, 15MB, 2GB.

  • thanks jonathan - couldn't see the wood from the trees. least this solution is out there now :)
    – johnwinter
    Commented Mar 6, 2013 at 15:58

This works for me:

<appender name="rollingCoreLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">

I think inserting the node timeBasedFileNamingAndTriggeringPolicy inside the rollingPolicy and using the %i as the index of the numbered files.

If you only want to use a Size triggering, then the previous solution of Jonathan works only if the rolling Policy is "FixedWindowRollingPolicy", not the TimeBasedRollingPolicy used by the logbacks of Tridion examples.

  • i was missing <prudent>true</prudent> and it worked.
    – Aamir
    Commented Feb 4, 2016 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.