Hi, Yes we are missing some logs, due to the asynchronous nature of the configuration update, there is a gap between the configuration update via ConfigurationAdmin and receiving the update to the ManagedService (in the PaxLoggingServiceImpl).
I further looked into the pax logging code and I think these kind of issues can be solved if there is a way to directly set the configuration file via a system property or some other mechanism. Then we can directly update PaxLoggingServiceImpl with the configuration and set the current configuration to the org.osgi.service.cm.Configuration which solve the issues if the bundle is refreshed. I tried the following fix and results seems to be promising. https://github.com/ops4j/org.ops4j.pax.logging/pull/29 Thanks, Jayanga. On Tue, Sep 6, 2016 at 4:22 PM, Niclas Hedhman <[email protected]> wrote: > I am sorry, but I haven't worked on this codebase for at least 5 years, > maybe much longer. Log4jv2 is after my time. > > But I just realized, are you saying that during log4j config update events > are lost? Isn't that a Log4j bug if that is the case. I thought you talked > about updating the log4j bundle itself. > > Niclas > > On Mon, Sep 5, 2016 at 2:37 PM, Jayanga Dissanayake <[email protected]> > wrote: > >> Hi, >> >> I tried using org.ops4j.pax.logging.useBufferingLogFallback=true, but no >> luck. So, I debug the code and found that according to the Log4jv2Logger >> implementation, paxLoggingManager is always available. So it doesn't try to >> create a BufferingLog. >> >> According to my requirement, there should be a way to identify whether >> the configuration updated is happed before continuing. As it is happening >> in a separate thread, currently there is no way to detect that. >> IMO, PaxLogging should publish an Event, once the Asynchronous >> configuration update is done, so that the interested parties can wait until >> that event is received. >> WDYT? >> >> Thanks, >> Jayanga. >> >> On Fri, Sep 2, 2016 at 2:53 PM, Niclas Hedhman <[email protected]> >> wrote: >> >>> >>> You could try setting the org.ops4j.pax.logging.useBufferingLogFallback >>> property to true. That should give you a PaxLogger that buffers logging >>> events while backend service is not available. >>> No idea how stable that is compared to the default one, so be prepared >>> to fix any issues you might encounter. >>> >>> Niclas >>> >>> On Wed, Aug 31, 2016 at 9:33 PM, Jayanga Dissanayake < >>> [email protected]> wrote: >>> >>>> Hi All, >>>> >>>> I am trying to update the configuration via "org.osgi.service.cm >>>> .Configuration" and once I update the configuration, some logs are >>>> missing (while the debug logs are enabled it should log all the bundle >>>> "BundleEvent INSTALLED", "BundleEvent RESOLVED" logs but these are missing >>>> in the logs.) >>>> >>>> I temporally add a thread sleep to the BundleActivatior start() after >>>> updating the configuration and then I can see all the bundles that I >>>> install, logging the above-mentioned output. >>>> It seems once I update the Configuration it takes a little time to get >>>> reflected. Has anyone faced the same thing before? >>>> >>>> I tried to register a "SynchronousConfigurationListener" and wait >>>> until the configuration update is received by this bundle. But still, the >>>> problem is there. >>>> >>>> Following is an extract from my code, >>>> >>>> //============================ >>>> ServiceReference reference = bundleContext.getServiceRefere >>>> nce(ConfigurationAdmin.class); >>>> if (reference != null) { >>>> ConfigurationAdmin configurationAdmin = (ConfigurationAdmin) >>>> bundleContext.getService(reference); >>>> Configuration configuration = >>>> configurationAdmin.getConfiguration("org.ops4j.pax.logging", >>>> null); >>>> ... >>>> Hashtable loggingProperties; >>>> ... >>>> // Loading the loggingProperties with log4j file location >>>> // "org.ops4j.pax.logging.log4j2.config.file" -> >>>> "[path_to_the_log4j_file]/log4j2.xml" >>>> configuration.update(loggingProperties); >>>> //============================= >>>> >>>> Does anyone has an idea what is happening? Or know how to guarantee >>>> that the configurations are updates before installing the other bundles? >>>> >>>> Thanks, >>>> Jayanga. >>>> >>>> -- >>>> -- >>>> ------------------ >>>> 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. >>>> >>> >>> >>> >>> -- >>> Niclas Hedhman, Software Developer >>> http://zest.apache.org - New Energy for Java >>> >>> -- >>> -- >>> ------------------ >>> OPS4J - http://www.ops4j.org - [email protected] >>> >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "OPS4J" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/to >>> pic/ops4j/e5dr9o8NxEk/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> 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. >> > > > > -- > Niclas Hedhman, Software Developer > http://zest.apache.org - New Energy for Java > > -- > -- > ------------------ > OPS4J - http://www.ops4j.org - [email protected] > > --- > You received this message because you are subscribed to a topic in the > Google Groups "OPS4J" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/ops4j/e5dr9o8NxEk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > 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.
