Should `Configurator.reconfigure` reconfigure existing `Loggers`?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Should `Configurator.reconfigure` reconfigure existing `Loggers`?

Benjamin Asbach
Hej.

I currently try to reconfigure log4j2 by using
`Configurator.reconfigure`:
https://gist.github.com/asbachb/6cac46a191ea47792bcf467cd865f06f

I'd expect that there's a console output like:
```
INFO1
INFO2
DEBUG2
```

but instead I just get:
```
INFO1
```

It seems that `Configurator.reconfigure does not reconfigure existing
logger instances. I wonder if this behaviour is expected?

Thanks
Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Should `Configurator.reconfigure` reconfigure existing `Loggers`?

Benjamin Asbach
So basically I recognized that `PropertiesConfigurationBuilder` is
clearing the passed `Properties`.

So when recreating the second properties my test case is working.


On 2020-04-29 13:39, Benjamin Asbach wrote:

> Hej.
>
> I currently try to reconfigure log4j2 by using
> `Configurator.reconfigure`:
> https://gist.github.com/asbachb/6cac46a191ea47792bcf467cd865f06f
>
> I'd expect that there's a console output like:
> ```
> INFO1
> INFO2
> DEBUG2
> ```
>
> but instead I just get:
> ```
> INFO1
> ```
>
> It seems that `Configurator.reconfigure does not reconfigure existing
> logger instances. I wonder if this behaviour is expected?
>
> Thanks
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]