jfont-teg opened a new issue, #1747:
URL: https://github.com/apache/logging-log4j2/issues/1747

   ## Description
   
   In MongoDb4 NoSql appender can't specify a capped collection size bigger 
than 2GB, due to the fact that the property is declared as a 32bits integer and 
is interpreted as bytes, so the maximum permissible value is 2^31 bytes = 2GB.
   
   MongoDB has no known size limit in capped collections, I just tested it and 
I have been able to create a capped collection at 100GB without problem.
   
   ## Configuration
   
   **Version:** 2.20.0
   
   ## Logs
   
   The error that appears:
   
   ```
   WARN StatusConsoleListener Error while converting string [26843545600] to 
type [int]. Using default value [null].
    java.lang.NumberFormatException: For input string: "26843545600"
        at 
java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
        at java.base/java.lang.Integer.parseInt(Integer.java:660)
        at java.base/java.lang.Integer.valueOf(Integer.java:991)
        at 
org.apache.logging.log4j.core.config.plugins.convert.TypeConverters$IntegerConverter.convert(TypeConverters.java:278)
        at 
org.apache.logging.log4j.core.config.plugins.convert.TypeConverters$IntegerConverter.convert(TypeConverters.java:274)
        at 
org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.convert(TypeConverters.java:420)
        at 
org.apache.logging.log4j.core.config.plugins.visitors.AbstractPluginVisitor.convert(AbstractPluginVisitor.java:151)
        at 
org.apache.logging.log4j.core.config.plugins.visitors.PluginBuilderAttributeVisitor.visit(PluginBuilderAttributeVisitor.java:49)
        at 
org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectFields(PluginBuilder.java:187)
        at 
org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
        at 
org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
        at 
org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
        at 
org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
        at 
org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
        at 
org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:664)
        at 
org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:258)
        at 
org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:304)
        at 
org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
        at 
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
        at 
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
        at 
org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
        at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
        at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
        at 
org.apache.logging.log4j.kotlin.LoggingFactoryKt.loggerDelegateOf(LoggingFactory.kt:64)
        at 
org.apache.logging.log4j.kotlin.LoggingFactoryKt.loggerOf(LoggingFactory.kt:68)
   ```
   
   ## Reproduction
   
   ```
   <Configuration status="WARN">
       <Appenders>
           <NoSql name="MongoDb" ignoreExceptions="false">
               <!--
                   Collection size = 26.843.545.600 bytes = 25GB d'espai sense 
comprimir
                   Espai ocupat real (comprimit) al voltant d'un 10-20% = 
2.5-5GB
               -->
               <MongoDb4 connection="mongodb://localhost:27017/Logs.Synchro" 
capped="true" collectionSize="26843545600"/>
           </NoSql>
       </Appenders>
   </Configuration>
   ```
   
   ## Known workaround
   
   Creating the collection through other means and configuring its capped size 
seems to work. Then you need to leave out this property from the configuration 
file. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to