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