You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Algirdas <al...@gmail.com> on 2010/07/26 21:45:52 UTC

Injecting Logger into non-component classes

Just to confirm that there is no other way -

I have DB access objects as separate XYZOperation classes. 
They are just classes, not pages or components.

How to inject Logger into them? 

The only logical solution would be to build special service, say
ContextService, 
which has logger, inject it into page/component where I use operations, 
and pass it to operation constructor.

Or there is a smarter way?
-- 
View this message in context: http://tapestry-users.832.n2.nabble.com/Injecting-Logger-into-non-component-classes-tp5339492p5339492.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Injecting Logger into non-component classes

Posted by Igor Drobiazko <ig...@gmail.com>.
You can inject LoggerSource service.

On Mon, Jul 26, 2010 at 9:45 PM, Algirdas <al...@gmail.com> wrote:

>
> Just to confirm that there is no other way -
>
> I have DB access objects as separate XYZOperation classes.
> They are just classes, not pages or components.
>
> How to inject Logger into them?
>
> The only logical solution would be to build special service, say
> ContextService,
> which has logger, inject it into page/component where I use operations,
> and pass it to operation constructor.
>
> Or there is a smarter way?
> --
> View this message in context:
> http://tapestry-users.832.n2.nabble.com/Injecting-Logger-into-non-component-classes-tp5339492p5339492.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Re: Injecting Logger into non-component classes

Posted by Josh Canfield <jo...@gmail.com>.
> I have DB access objects as separate XYZOperation classes.
> They are just classes, not pages or components.
>
> How to inject Logger into them?

Why can't your XYZOperation classes be services?

> The only logical solution would be to build special service, say
> ContextService,
> which has logger, inject it into page/component where I use operations,
> and pass it to operation constructor.

I don't follow why you would need a ContextService to hold the logger.
Can't you just inject the logger into the page/component? Are you
wanting a different category?

Josh

On Mon, Jul 26, 2010 at 12:45 PM, Algirdas <al...@gmail.com> wrote:
>
> Just to confirm that there is no other way -
>
> I have DB access objects as separate XYZOperation classes.
> They are just classes, not pages or components.
>
> How to inject Logger into them?
>
> The only logical solution would be to build special service, say
> ContextService,
> which has logger, inject it into page/component where I use operations,
> and pass it to operation constructor.
>
> Or there is a smarter way?
> --
> View this message in context: http://tapestry-users.832.n2.nabble.com/Injecting-Logger-into-non-component-classes-tp5339492p5339492.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org