@Paul, what is the issue with using SLF4J?
SLF4J code in every bundle? Usually, the only SLF4J code I have is:

> private static final Logger LOGGER = LoggerFactory.getLogger(Acme.class);

The LoggerFactory provided by Karaf (Pax Logging) will take care of the
rest.

For the Log service to be injected, as shown in your example, all the
classes requiring a logger will need to be DS components. You probably
don't want/need that.
During unit test, you will also need to "inject"/set the logger.
My suggestion is to stick with SLF4J. Your code will be independent of the
logging library/framework running under the hood, and probably most of the
libraries you are using are also using SLF4J.

Best regards,
João Assunção

Email: [email protected]
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com




On Wed, May 1, 2019 at 1:27 PM Jean-Baptiste Onofré <[email protected]> wrote:

> By the way, I will blog and send an update on the mailing list about R7
> in Karaf, I will add a section about the logging.
>
> Regards
> JB
>
> On 01/05/2019 12:56, Paul Fraser wrote:
> > Hi,
> >
> > B J Hargrave has developed an Slf4j/OSGi bundle which routes all slf4j
> > log events to the new R7 osgi log service.
> >
> > https://www.youtube.com/watch?v=DJF0aETiNec&feature=youtu.be about 24
> > mins in.
> >
> > 19min 30s into video he shows how the new log service is used ()
> >
> >  ===========================
> >
> >   @Reference(service=LoggerFactory.class)
> >
> >     private Logger logger;
> >
> > and then as usual in code
> >
> >     logger.info("Hello new bundle");
> >
> > =============================
> >
> >  I would like to be able to use this new logging asusage in code
> > requires only this @Reference entry and no need for the slf4j code
> > usually required in every bundle.
> >
> > Being very new to Karaf, any guidance available as to how to set up the
> > logging config to achieve this end would be most appreciated.
> >
> > I am running Karaf 4.3-SNAPSHOT.
> >
> > Paul Fraser
> >
> >
> >
> >
> >
>
> --
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Reply via email to