title: Logback giving error Cannot cast object '3 gb' with class 'java.lang.String' to class 'ch.qos.logback.core.util.FileSize'
body: <p>I have a springboot application and while trying to log using logback with groovy config I am getting following error:</p>
  
  <pre><code>    Failed to instantiate [ch.qos.logback.classic.LoggerContext]
  Reported exception:
  org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '3 gb' with class 'java.lang.String' to class 'ch.qos.logback.core.util.FileSize'
      at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405)
      at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319)
  </code></pre>
  
  <p>My groovy config file:</p>
  
  <pre><code>import ch.qos.logback.classic.PatternLayout
  import static ch.qos.logback.classic.Level.INFO
  
  scan("60 seconds")
  def LOG_PATH = "logs"
  def LOG_ARCHIVE = "${LOG_PATH}/archive"
  
  
  
  appender("RollingFile-Appender", RollingFileAppender) {
      file = "${LOG_PATH}/rollingfile.log"
      rollingPolicy(TimeBasedRollingPolicy) {
          fileNamePattern = "${LOG_ARCHIVE}/Rainbow_Notifications.log%d{yyyy-MM-dd}.log"
          maxHistory = 30
          totalSizeCap = "3 gb"
      }
      encoder(PatternLayoutEncoder) {
          pattern = "%msg%n"
      }
  }
  
  
  logger("com.something", INFO, ["RollingFile-Appender"])
  </code></pre>
  
  <p><strong>Note:</strong> I have tried even these strings:as file size: <code>3gb</code>, <code>3 gb</code>, <code>3GB</code>,<code>3096mb</code>,<code>3096 mb</code>,<code>3096 MB</code></p>