Default Logger

2019-05-11 Thread Richard Monson-Haefel
Hi!

Is there a default logger in TomEE that can be injected into an EJB
(specifically and MDB)?  If so, can someone point me to the documentation.
I can't find anything.

Thanks,

Richard

-- 
Richard Monson-Haefel
https://twitter.com/rmonson
https://www.tomitribe.com/


Re: Default Logger?

2019-05-10 Thread Richard Monson-Haefel
Thank you, Jean-Louis!  That helps a lot!

On Fri, May 10, 2019 at 11:33 AM Jean-Louis Monteiro <
jlmonte...@tomitribe.com> wrote:

> Hi,
>
> Yes there is a wrapper so we can delegate to JUL (Java Util Logging), Log4j
> etc depending on what the user decides.
> You would need to create a dependency to openejb-core in your app.
>
> If this is an example, I would suggest to use JUL which is available by
> default in the JDK and works quite well.
>
> In terms of injecting a Logger into an EJB, you can do it, but you need to
> create a CDI producer that calls basically Logger.getLogger() and
> then use @Inject in your EJB.
>
> In the EJB ...
>
> @Inject
> > Logger logger;
>
>
> The producer would look like this more or less
>
> public class LoggerProducer {
> >
> >
> >
> > @Produces
> >
> > public Logger getLogger(InjectionPoint injectionPoint) {
> >
> > return Logger.getLogger(
> >
> >
> >> injectionPoint.getBean().getBeanClass().getName());
> >
> > }
> >
> >
> >
> > }
> >
> >
> Hope it helps.
>
>
> --
> Jean-Louis Monteiro
> http://twitter.com/jlouismonteiro
> http://www.tomitribe.com
>
>
> On Fri, May 10, 2019 at 6:22 PM Richard Monson-Haefel <
> monsonhae...@gmail.com> wrote:
>
> > Hi!
> >
> > Is there a default logger in TomEE that can be injected into an EJB
> > (specifically and MDB)?  If so, can someone point me to the
> documentation.
> > I can't find anything.
> >
> > Thanks,
> >
> > Richard
> >
> > --
> > Richard Monson-Haefel
> > https://twitter.com/rmonson
> > https://www.linkedin.com/in/monsonhaefel/
> >
>


-- 
Richard Monson-Haefel
https://twitter.com/rmonson
https://www.linkedin.com/in/monsonhaefel/


Re: Default Logger?

2019-05-10 Thread Jean-Louis Monteiro
Hi,

Yes there is a wrapper so we can delegate to JUL (Java Util Logging), Log4j
etc depending on what the user decides.
You would need to create a dependency to openejb-core in your app.

If this is an example, I would suggest to use JUL which is available by
default in the JDK and works quite well.

In terms of injecting a Logger into an EJB, you can do it, but you need to
create a CDI producer that calls basically Logger.getLogger() and
then use @Inject in your EJB.

In the EJB ...

@Inject
> Logger logger;


The producer would look like this more or less

public class LoggerProducer {
>
>
>
> @Produces
>
> public Logger getLogger(InjectionPoint injectionPoint) {
>
> return Logger.getLogger(
>
>
>> injectionPoint.getBean().getBeanClass().getName());
>
> }
>
>
>
> }
>
>
Hope it helps.


--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Fri, May 10, 2019 at 6:22 PM Richard Monson-Haefel <
monsonhae...@gmail.com> wrote:

> Hi!
>
> Is there a default logger in TomEE that can be injected into an EJB
> (specifically and MDB)?  If so, can someone point me to the documentation.
> I can't find anything.
>
> Thanks,
>
> Richard
>
> --
> Richard Monson-Haefel
> https://twitter.com/rmonson
> https://www.linkedin.com/in/monsonhaefel/
>


Default Logger?

2019-05-10 Thread Richard Monson-Haefel
Hi!

Is there a default logger in TomEE that can be injected into an EJB
(specifically and MDB)?  If so, can someone point me to the documentation.
I can't find anything.

Thanks,

Richard

-- 
Richard Monson-Haefel
https://twitter.com/rmonson
https://www.linkedin.com/in/monsonhaefel/