You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "jfont-teg (via GitHub)" <gi...@apache.org> on 2023/09/01 10:18:20 UTC

[I] In MongoDb4 NoSql appender can't specify a capped collection size bigger than 2GB (logging-log4j2)

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: notifications-unsubscribe@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In MongoDb4 NoSql appender can't specify a capped collection size bigger than 2GB (logging-log4j2)

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #1747:
URL: https://github.com/apache/logging-log4j2/issues/1747#issuecomment-1702591006

   Thanks for the report @jfont-teg! I think by simply changing the type of `collectionSize` from `int` to `long`, we would disrupt the backward compatibility least and address your concern. Agreed?
   
   Would you mind submitting a patch targeting `2.x` branch with the following changes, please?
   1. Change the type of `collectionSize` field from `int` to `long` in `MongoDbProvider` and `MongoDb4Provider` classess (Please try to spot all usages of the field; in the class, in the builder, in tests, etc.)
   2. Update docs, i.e., `appenders.xml`
   3. Create a changelog entry file in `src/changelog/.2.x.x`


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In MongoDb4 NoSql appender can't specify a capped collection size bigger than 2GB (logging-log4j2)

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #1747:
URL: https://github.com/apache/logging-log4j2/issues/1747#issuecomment-1703866676

   @jfont-teg, I have noticed your PR. :heart: Just before that, @garydgregory simply submitted a PR without much thinking, though with all good intentions. I hope his action didn't create an impression that your PR was for nothing. Thank you so much for the report and the PR, they mean a lot to us, please keep them coming. :star_struck:


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In MongoDb4 NoSql appender can't specify a capped collection size bigger than 2GB (logging-log4j2)

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on issue #1747:
URL: https://github.com/apache/logging-log4j2/issues/1747#issuecomment-1702618579

   Using a `long` should be OK since we use `com.mongodb.client.model.CreateCollectionOptions.sizeInBytes(long)`. That was an flub on my part.


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In MongoDb4 NoSql appender can't specify a capped collection size bigger than 2GB (logging-log4j2)

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #1747:
URL: https://github.com/apache/logging-log4j2/issues/1747#issuecomment-1703866781

   Closing due to #1749.


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] In MongoDb4 NoSql appender can't specify a capped collection size bigger than 2GB (logging-log4j2)

Posted by "vy (via GitHub)" <gi...@apache.org>.
vy closed issue #1747: In MongoDb4 NoSql appender can't specify a capped collection size bigger than 2GB
URL: https://github.com/apache/logging-log4j2/issues/1747


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org