wt., 21 maj 2024 o 15:47 Matthias Leinweber <m.leinwe...@datatactics.de>
napisał(a):

> Hi,
>
> this is at least an explanation for the refresh. But the bootFeatures
> still seem bugg. Should i try to create a simple test with karaf examples?
>

If you provide some github example, I could review it ;)

regards
Grzegorz


>
> br,
> Matthias
>
> On Tue, 21 May 2024 at 15:31, Grzegorz Grzybek <gr.grzy...@gmail.com>
> wrote:
>
>> The logs should contain an explanation.
>>
>> pax-logging-log4j2 (or your fragment) may contain some optional
>> (resolution:=optional) imports which are satisfied by some bundles from
>> Camel features... This makes Karaf's FeatureService include Pax Logging in
>> the set of "bundles to refresh".
>> The details should be in the logs.
>>
>> regards
>> Grzegorz
>>
>> wt., 21 maj 2024 o 15:25 Matthias Leinweber <m.leinwe...@datatactics.de>
>> napisał(a):
>>
>>> Hi,
>>>
>>>
>>> >> compile scopeby default goes to "startup" phase of "profile
>>> management".
>>> Ah ok this is working now too..
>>>
>>> Then it is also added to the boot features.
>>>>
>>>>
>>>> Hmm, I'm not sure why's that... Even if it's true (I can't check now),
>>>> it shouldn't affect the process and cause extra refreshes.
>>>> In extreme case, where all the features are "startup", you should get
>>>> all the bundles installed (and active if not fragments) the moment Karaf's
>>>> FeatureService kicks in...
>>>>
>>>
>>> The thing is when i install e.g. feature camel, pax-logging gets
>>> restarted for idk why. If i remove  rahla.logging from
>>>
>>> featuresBoot = \
>>>     instance/4.4.6, \
>>>     package/4.4.6, \
>>>     log/4.4.6, \
>>>     rahla.logging/1.0.16.SNAPSHOT, \
>>>     ssh/4.4.6, \
>>>     pax-url-wrap/2.6.14, \
>>>     framework/4.4.6, \
>>>     system/4.4.6, \
>>>     feature/4.4.6, \
>>>     shell/4.4.6, \
>>>     management/4.4.6, \
>>>     service/4.4.6, \
>>>     jaas/4.4.6, \
>>>     shell-compat/4.4.6, \
>>>     deployer/4.4.6, \
>>>     diagnostic/4.4.6, \
>>>     bundle/4.4.6, \
>>>     config/4.4.6, \
>>>     kar/4.4.6
>>>
>>> then it does not get restarted when I install camel. This drives me
>>> crazy.
>>>
>>>
>>> Maven build says:
>>> [INFO]    Loading boot repositories
>>> ...
>>> [INFO]       adding feature repository:
>>> mvn:rahla.feature/rahla.logging/1.0.16-SNAPSHOT/xml/features
>>> ...
>>> [INFO]    Feature rahla.logging/1.0.16.SNAPSHOT is defined as a boot
>>> feature
>>> [INFO]       adding maven artifact:
>>> mvn:com.fasterxml.jackson.core/jackson-annotations/2.15.2
>>> [INFO]       adding maven artifact:
>>> mvn:rahla/loki-appender/1.0.16-SNAPSHOT
>>> [INFO]       adding maven artifact:
>>> mvn:com.fasterxml.jackson.core/jackson-databind/2.15.2
>>> [INFO]       adding maven artifact:
>>> mvn:org.ops4j.pax.logging/pax-logging-log4j2-extra/2.2.7
>>> [INFO]       adding maven artifact:
>>> mvn:com.fasterxml.jackson.core/jackson-core/2.15.2
>>> ...
>>>
>>> Boot and installed looks like:
>>>
>>> /home/mleinweber/projects/rahla/assembly/pom.xml
>>>
>>> All dependency features are scope runtime except rahla.logging which is
>>> compile
>>> <bootFeatures>
>>>             <feature>pax-url-wrap</feature>
>>>             <feature>shell</feature>
>>>             <feature>shell-compat</feature>
>>>             <feature>feature</feature>
>>>             <feature>jaas</feature>
>>>             <feature>ssh</feature>
>>>             <feature>management</feature>
>>>             <feature>bundle</feature>
>>>             <feature>config</feature>
>>>             <feature>deployer</feature>
>>>             <feature>diagnostic</feature>
>>>             <feature>feature</feature>
>>>             <feature>instance</feature>
>>>             <feature>kar</feature>
>>>             <feature>log</feature>
>>>             <feature>package</feature>
>>>             <feature>service</feature>
>>>             <feature>system</feature>
>>>           </bootFeatures>
>>>           <installedFeatures>
>>>             <feature>fradi</feature>
>>>           </installedFeatures>
>>>
>>>
>>> Startup works fine
>>> mvn\:org.apache.karaf.features/org.apache.karaf.features.extension/4.4.6
>>> = 1
>>> mvn\:org.ops4j.pax.url/pax-url-aether/2.6.14 = 5
>>> mvn\:org.ops4j.pax.logging/pax-logging-api/2.2.7 = 8
>>> mvn\:com.fasterxml.jackson.core/jackson-annotations/2.15.2 = 8
>>> mvn\:org.ops4j.pax.logging/pax-logging-log4j2/2.2.7 = 8
>>> mvn\:org.ops4j.pax.logging/pax-logging-log4j2-extra/2.2.7 = 8
>>> mvn\:rahla/loki-appender/1.0.16-SNAPSHOT = 8
>>> mvn\:com.fasterxml.jackson.core/jackson-core/2.15.2 = 8
>>>
>>> I  debugged a bit during build process:
>>>
>>> Profile bootOverlay = Profiles.getOverlay(bootProfile, allProfiles,
>>> environment);
>>> adds the startup features (my library + "framework") before
>>> Profile bootEffective = Profiles.getEffective(bootOverlay, false); ..
>>> and bootEffective.getFeatures() is used
>>>
>>> br,
>>> Matthias
>>>
>>> On Tue, 21 May 2024 at 13:29, Grzegorz Grzybek <gr.grzy...@gmail.com>
>>> wrote:
>>>
>>>> Hi
>>>>
>>>> compile scopeby default goes to "startup" phase of "profile
>>>> management". See some comments I've added to Fuse Karaf with
>>>> karaf-maven-plugin:
>>>> https://github.com/jboss-fuse/fuse-karaf/blob/7.x.redhat-7-x/assemblies/fuse-karaf/pom.xml#L208-L225
>>>> (it's a public repo).
>>>>
>>>> So in practice there's no such thing as "startup feature" - simply the
>>>> bundles from such feature go to etc/startup.properties, preserving
>>>> start-level attribute of a <bundle> within such <feature>. This should be
>>>> the way you add a fragment bundle for Pax Logging - as early as possible.
>>>>
>>>> Then it is also added to the boot features.
>>>>
>>>>
>>>> Hmm, I'm not sure why's that... Even if it's true (I can't check now),
>>>> it shouldn't affect the process and cause extra refreshes.
>>>> In extreme case, where all the features are "startup", you should get
>>>> all the bundles installed (and active if not fragments) the moment Karaf's
>>>> FeatureService kicks in...
>>>>
>>>> regards
>>>> Grzegorz Grzybek
>>>>
>>>> wt., 21 maj 2024 o 13:15 Matthias Leinweber <m.leinwe...@datatactics.de>
>>>> napisał(a):
>>>>
>>>>> Hello Grzegorz,
>>>>>
>>>>> now connecting the dots which jboss fuse and your expert knowledge ;)
>>>>>
>>>>> Anyway I shaded the additional library and didn't add the import.
>>>>> Anyway, a new problem when I add a feature with scope compile to the
>>>>> startupFeature config. Then it is also added to the boot features. This
>>>>> causes a restart of pax-logging-log4j2 which causes some trouble with the
>>>>> appender code.
>>>>>
>>>>> I currently try to see if something like:
>>>>>
>>>>>           <startupBundles>
>>>>>             <bundle
>>>>> start-level="8">mvn:org.ops4j.pax.logging/pax-logging-log4j2-extra/${pax-logging.version}</bundle>
>>>>> <!--mor bundles-->
>>>>>           </startupBundles>
>>>>> is possible and get rid of the extra feature. But it seems that
>>>>> start-level is always 30.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> On Tue, 21 May 2024 at 11:41, Grzegorz Grzybek <gr.grzy...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> `org.osgi.framework.system.packages.extra` can be changed in
>>>>>> karaf-maven-plugin when building custom Karaf distro. You can also 
>>>>>> provide
>>>>>> your own config.properties - that's what we do in Fuse Karaf.
>>>>>>
>>>>>> But I think the easiest solution for you is to exclude generation of
>>>>>> such import clause by adding `!sun.nio.ch` if you're not really
>>>>>> using it in your fragment.
>>>>>>
>>>>>> regards
>>>>>> Grzegorz Grzybek
>>>>>>
>>>>>>
>>>>>>
>>>>>> wt., 21 maj 2024 o 10:58 Matthias Leinweber <
>>>>>> m.leinwe...@datatactics.de> napisał(a):
>>>>>>
>>>>>>> I figured out that i added my logging stuff too late.: As a bundle
>>>>>>> dependency in the assembly with a startup level which is too high (30)
>>>>>>> which results in a restart of the logging system. Anyway after creating 
>>>>>>> an
>>>>>>> additional feature with start level 8 and adding it to startupFeatures 
>>>>>>> i am
>>>>>>> pretty close to a solution.
>>>>>>>
>>>>>>> But i get
>>>>>>> [ERROR] Failed to execute goal
>>>>>>> org.apache.karaf.tooling:karaf-maven-plugin:4.4.6:assembly
>>>>>>> (default-assembly) on project rahla: Unable to build assembly: Unable to
>>>>>>> resolve root: missing requirement [root] osgi.identity;
>>>>>>> osgi.identity=rahla.logging; type=karaf.feature; 
>>>>>>> version=1.0.16.SNAPSHOT;
>>>>>>> filter:="(&(osgi.identity=rahla.logging)(type=karaf.feature)(version>=1.0.16.SNAPSHOT))"
>>>>>>> [caused by: Unable to resolve rahla.logging/1.0.16.SNAPSHOT: missing
>>>>>>> requirement [rahla.logging/1.0.16.SNAPSHOT] osgi.identity;
>>>>>>> osgi.identity=org.agrona.core; type=osgi.bundle; 
>>>>>>> version="[1.12.0,1.12.0]";
>>>>>>> resolution:=mandatory [caused by: Unable to resolve 
>>>>>>> org.agrona.core/1.12.0:
>>>>>>> missing requirement [org.agrona.core/1.12.0] osgi.wiring.package;
>>>>>>> filter:="(osgi.wiring.package=sun.nio.ch)"]]
>>>>>>>
>>>>>>> I am currently digging through the source code to see if I can
>>>>>>> change org.osgi.framework.system.packages.extra during execution of the
>>>>>>> plugin? Or does anyone know a better solution?
>>>>>>>
>>>>>>> br,
>>>>>>> Matthias
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Sat, 18 May 2024 at 10:33, Matthias Leinweber <
>>>>>>> m.leinwe...@datatactics.de> wrote:
>>>>>>>
>>>>>>>> Thank you for the support. Worked like a charm.
>>>>>>>>
>>>>>>>> Grzegorz Grzybek <gr.grzy...@gmail.com> schrieb am Sa., 18. Mai
>>>>>>>> 2024, 08:47:
>>>>>>>>
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> You should not get this file from original jar - it has to be
>>>>>>>>> generated using Maven configuration of two Maven plugins:
>>>>>>>>>
>>>>>>>>>    - maven-compiler-plugin to configure
>>>>>>>>>    
>>>>>>>>> org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor
>>>>>>>>>    - maven-bundle-plugin to ensure resource mapping:
>>>>>>>>>    
>>>>>>>>> META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat=target/classes/META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
>>>>>>>>>
>>>>>>>>> See:
>>>>>>>>> https://github.com/ops4j/org.ops4j.pax.logging/blob/main/pax-logging-samples/fragment-log4j2/pom.xml#L41-L77
>>>>>>>>>
>>>>>>>>> regards
>>>>>>>>> Grzegorz Grzybek
>>>>>>>>>
>>>>>>>>> pt., 17 maj 2024 o 19:28 Matthias Leinweber <
>>>>>>>>> m.leinwe...@datatactics.de> napisał(a):
>>>>>>>>>
>>>>>>>>>> Ok, it doesn't seem so complicated.. Anyway, my java skills are a
>>>>>>>>>> bit outdated. Working with private-package looks good in the first 
>>>>>>>>>> place.
>>>>>>>>>> But how do I get the Log4j2Plugins.dat out of the original jar into 
>>>>>>>>>> my
>>>>>>>>>> bundle?
>>>>>>>>>>
>>>>>>>>>> On Fri, 17 May 2024 at 16:55, Grzegorz Grzybek <
>>>>>>>>>> gr.grzy...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello
>>>>>>>>>>>
>>>>>>>>>>> You can find a sample fragment here:
>>>>>>>>>>> https://github.com/ops4j/org.ops4j.pax.logging/tree/main/pax-logging-samples/fragment-log4j2
>>>>>>>>>>> That's all there is ;(
>>>>>>>>>>>
>>>>>>>>>>> regards
>>>>>>>>>>> Grzegorz Grzybek
>>>>>>>>>>>
>>>>>>>>>>> pt., 17 maj 2024 o 16:26 Matthias Leinweber <
>>>>>>>>>>> m.leinwe...@datatactics.de> napisał(a):
>>>>>>>>>>>
>>>>>>>>>>>> Hello Karaf Team,
>>>>>>>>>>>>
>>>>>>>>>>>> is it possible to directly add a custom log4j2 appender via
>>>>>>>>>>>> wrap protocol?
>>>>>>>>>>>>
>>>>>>>>>>>> I added log4j2.packages = pl.tkowalcz.tjahzi.log4j2 to
>>>>>>>>>>>> org.ops4j.pax.logging.cfg but i get ERROR : Unable to locate 
>>>>>>>>>>>> plugin for Loki
>>>>>>>>>>>>
>>>>>>>>>>>> I fear that i have to build a fragment bundle for pax logging
>>>>>>>>>>>> .. if yes where can i find some doc?
>>>>>>>>>>>>
>>>>>>>>>>>> br.
>>>>>>>>>>>> Matthias
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>
>
>

Reply via email to