Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-10-02 Thread Grzegorz Grzybek
Hello For log4j, there's https://github.com/ops4j/org.ops4j.pax.logging/blob/master/pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/appender/PaxOsgiAppender.java that does just that - uses in-memory buffer. It's registered as log4j plugin. I would so similar thing - register an

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-10-02 Thread Guillaume Nodet
2017-10-02 6:43 GMT+02:00 Asma Zinneera Jabir : > > The way I have configured Log4j2 is through the following entry in > pax-logging.properties. > > org.ops4j.pax.logging.log4j2.config.file=path/to/log4j2.properties > You can configure the properties directly in the

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-10-01 Thread Asma Zinneera Jabir
The way I have configured Log4j2 is through the following entry in pax-logging.properties. org.ops4j.pax.logging.log4j2.config.file=path/to/log4j2.properties So when I try: Hashtable log4jProps = new Hashtable(); log4jProps.put(

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-09-22 Thread Guillaume Nodet
You can't because that's not how pax-logging is working. The configuration is done via ConfigAdmin, so if you want to modify your configuration, the best way would be to modify that configuration to suit your needs. 2017-09-22 14:40 GMT+02:00 Asma Zinneera Jabir : > I tried

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-09-22 Thread Grzegorz Grzybek
Hello I'm afraid this looks like an enhancement then... Please create PAXLOGGING issue at https://ops4j1.jira.com/projects/PAXLOGGING project. regards Grzegorz Grzybek 2017-09-22 14:40 GMT+02:00 Asma Zinneera Jabir : > I tried the above methods you had suggested but still

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-09-22 Thread Asma Zinneera Jabir
I tried the above methods you had suggested but still could not get the configuration. 1st suggestion - casting to org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext does not work since the needed methods (methods needed to get and update loggers) aren't available in Log4jv2LoggerContext 2nd

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-09-20 Thread Grzegorz Grzybek
Hmm The org.apache.logging.log4j.core.config.Configurator#setLevel() which is part of the stack trace only puts single logger configuration (if it's not present). But I think it's possible to use pax-logging to achieve what you want. Don't use Log4j facilities (like LogManager.getContext()).

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-09-20 Thread Grzegorz Grzybek
Hello The exact explanation is: org.apache.logging.log4j.core.LoggerContext#getContext() method explicitly casts org.apache.logging.log4j.LogManager#getContext() result (which by declaration is interface org.apache.logging.log4j.spi.LoggerContext) to org.apache.logging.log4j.core.LoggerContext

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-09-20 Thread Asma Zinneera Jabir
I am facing the same issue when trying to get the context using LoggerContext ctx = (LoggerContext) LogManager.getContext(). Is there a way to get the context from spi.LoggerContext in pax-logging?? On Wednesday, August 9, 2017 at 9:00:12 PM UTC+5:30, Jérémie Brébec wrote: > > Hello, > > I am

Re: PaxLogging: org.ops4j.pax.logging.log4jv2.Log4jv2LoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

2017-08-09 Thread Jérémie Brébec
Yes, that is the first thing I checked. However LoggerContext.getContext() try to cast the context into a org.apache.logging.log4j.core.LoggerContext and