You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's no way to create MongoDb4Provider programmatically. Setter for connectionStringSource is missing in Builder.
Configuration
Version: 2.14.0+ (From the first version when MongoDB 4 support was added)
The text was updated successfully, but these errors were encountered:
ihordz
changed the title
Missing setter for connectionStringSource on MongoDb4Provider
Missing setter for connectionStringSource in MongoDb4Provider
Mar 24, 2023
ihordz
added a commit
to ihordz/logging-log4j2
that referenced
this issue
Mar 24, 2023
Thanks so much for the report and the PR @ihordz, much appreciated! I will merge them momentarily.
You are both right and wrong. You're right that MongoDb4Provider indeed doesn't expose connectionStringSource in its builder. That said, you don't (and shouldn't!) need that for programmatic configuration. You shouldn't be using the MongoDb4Provider class directly, but rather be accessing it via AppenderComponentBuilder. See the programmatic configuration guide for details.
As a matter of fact, by accessing the classes directly rather than using the configuration API, you are walking on thin ice. Log4j crew strives to provide backward compatibility at the API (i.e., log4j-api) and configuration level, though we are not that strict when it comes to the implementation (i.e., log4j-core) itself. Hence, I strongly advise you to always stick to the configuration API for programmatic configuration.
Description
It's no way to create
MongoDb4Provider
programmatically. Setter forconnectionStringSource
is missing in Builder.Configuration
Version: 2.14.0+ (From the first version when MongoDB 4 support was added)
The text was updated successfully, but these errors were encountered: