Hi Will Did you take a look on https://github.com/apache/karaf/tree/main/examples/karaf-log-appender-example ?
Generally speaking, the org.apache.logging* packages should be imported in your bundle. The fragment would extend an existing bundle classloader with your classes. Maybe if you share a test case bundle, I can show you how to do this. Regards JB On Wed, Mar 13, 2024 at 6:28 PM Will Hartung <willhart...@gmail.com> wrote: > > > > On Mon, Mar 11, 2024 at 11:33 PM Grzegorz Grzybek <gr.grzy...@gmail.com> > wrote: >> >> Hello >> >> Pax Logging (where pax-logging-api contains and exports Logging APIs, while >> pax-logging-log4j2 is the Log4j2-based implementation) has enormous amount >> of effort put into integration of very different logging packages and it is >> used by Apache Karaf among others. >> >> The team developed Pax Logging for many years trying to maintain old APIs >> and include new ones. Among others, there's one consequence of this - either >> you use Pax Logging and accept some (workarounds possible) limitation or you >> craft your own set of bundles approaching what Pax Logging does anyway. >> >> Your issue is simple - your "caterwaul-connect-core" bundle imports >> "org.apache.logging.log4j.core" which is simply NOT exported by >> pax-logging-log4j2. This (at first glance) means you NEED actual Log4j2 >> bundles installed. >> >> However - are you sure your "caterwaul-connect-core" bundle really needs >> this package? is it implementing custom appenders/layouts/plugins? If so, >> it's better (and Pax Logging contains relevant examples) to create a >> fragment bundle attached to pax-logging-log4j2 bundle. >> > Hi, thanks for getting back. > > Yes, it seems that the code is doing a couple of things. One is creating its > own appender, and another it seems to be looking at different kinds of events > that contain raw logging information, so it's using some of the classes to > extract information from those. > > So, for this fragment, do I simply need to make a fragment containing the > extra log4j information, or do I need to extract the code that is using those > log4j pieces and put that into a fragment. That seems to be a much taller > order. Compared to bolting the necessary log4j.core classes onto the pax > bundle so that those classes are then available to everyone from the pax > bundles classloader. > > Thanks! > > Regards, > > Will Hartung >