When the mongodb4 appender was created for log4j2, the ability to specify a
factory class/method in the log4j2.xml file was removed, and the
configuration option was instead reverted to requiring a simple connection
string.
Was there a technical reason why that needed to happen, or was it just for
Hello Julian,
When I created the version 4 of the MongoDB appender, I realized that for
all the use cases I had and I felt were reasonable, I could use a
connection string, a bit like you can in JDBC, which I could not do with a
version 3 driver. There are two settings IIRC that I did not find map
Hi Gary
It's been a while, but I'm trying this now. I don't understand where the
opportunity is to inject values in the way you're describing (the $$
approach) when log4j2 is being instantiated at startup time by Spring. By
the time we reach 'my' code, it's too late and the mongodb4 setup has
alre
If I understand what Gary is saying correctly is that you would configure your
Log4j2.xml file with the connection string for MongoDB. In the connection
string you would have variables. If the variable is of the form ${varName} then
it will be resolved when the configuration is processed. If a v
What Ralph said :-)
The tests in Log4j as well as the ones I have at work all use one $ in
connection strings. I do not have tests that use $$.
Gary
On Mon, Mar 8, 2021, 11:13 Ralph Goers wrote:
> If I understand what Gary is saying correctly is that you would configure
> your Log4j2.xml file
Gary - the $$ form requires that the component call StrSubstitutor to resolve
the variables. If the application needs to do that for some reason then the
Appender would need to support it.
Ralph
> On Mar 8, 2021, at 9:46 AM, Gary Gregory wrote:
>
> What Ralph said :-)
>
> The tests in Log4j
Sure I know that, I just don't recall if I accounted for $$ in the
code for MongoDB...
G ;-) I'll peek tonight.
On Mon, Mar 8, 2021 at 2:40 PM Ralph Goers wrote:
>
> Gary - the $$ form requires that the component call StrSubstitutor to resolve
> the variables. If the application needs to do tha
Perhaps it would help if I explain the scenario better. In this
application, the MongoDB credentials are not known at design time, nor are
they known immediately at start-up time. They're only known when the
application has started and has had a chance to go and retrieve them from a
secure credenti
Well, hot dog dang I don't see support for $$ in MongoDb4Provider.
Ideally I think the provider should be fed a Configuration where the
StrSubstitutor can be accessed.
If you want to provide a failing unit test in that component, I can take a
look at it.
But, I am not sure if that will solve the
If you create a custom Lookup, say CredentialsLookup, when it is called you can
make the same query your factory method did. The result of that would then be
merged into the connections string for Mongo. By the time the Appender would be
resolving that string the Lookup would definitely be avail
Hi Ralph - that's great, thank you, and it was exactly the steer I needed.
All now working. As so often, the fix is about 15 lines of code it's
just knowing *which* 15 lines of code to write that's the challenge. Thanks
again.
Julian
On Tue, 9 Mar 2021 at 15:37, Ralph Goers wrote:
> If you
11 matches
Mail list logo