I got it by using the ConfigurationAdmin, it works but i'm not sure if it's 
the best approach, i saw that the PaxLoggingServiceImpl 
<https://github.com/ops4j/org.ops4j.pax.logging/blob/master/pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/internal/PaxLoggingServiceImpl.java>
 
from the Log4j2 bundle does have the Log4j2 LoggerContext, i think it would 
be easier to interact directly with it.

Em segunda-feira, 17 de dezembro de 2018 10:33:59 UTC-2, Grzegorz Grzybek 
escreveu:
>
> Hello
>
> I don't recall the details now, but please check similar discussion from 
> last year: 
> https://groups.google.com/forum/#!msg/ops4j/yjqOzvrKRkc/t5BXmfyoBgAJ
>
> regards
> Grzegorz Grzybek
>
> pon., 17 gru 2018 o 13:23 Ygor Castor <[email protected] <javascript:>> 
> napisaƂ(a):
>
>> Hello! I have an use case that i need to register an appender to the 
>> RootLogger in runtime, but i'm having tons of trouble with that, i've done 
>> it before in a Non-OSGi application by simply getting the Log4j2 context 
>> and adding a appender to the configuration: 
>>
>>
>>    1.     final LoggerContext context = LoggerContext.getContext(false);
>>    2.    final Configuration config = context.getConfiguration();
>>        final Appender appender = createAppender()
>>        config.addApender(appender)
>>
>>
>> But i can't do that when using pax-logging, the first problem is that the 
>> LoggerContext is not the Apache one, it's the Log4jv2LoggerContext from 
>> pax-logging which does not help me, is there any way i can register an 
>> appender at runtime?
>>
>> -- 
>> -- 
>> ------------------
>> OPS4J - http://www.ops4j.org - [email protected] <javascript:>
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to