> Injection does not work everywhere. As
> I said I have a Dispatcher, which does not get the Logger injected (I get
> NPE). But if I obtain the logger using:

For services you pass the logger as a constructor parameter and when
it is built Tapestry gives you a reference. Take a look at the
TapestryModule for examples.

Josh

On Thu, Apr 24, 2008 at 5:27 AM, János Jarecsni
<[EMAIL PROTECTED]> wrote:
> Hi Tomasz,
>
> now, that helped! :) With one remark. Injection does not work everywhere. As
> I said I have a Dispatcher, which does not get the Logger injected (I get
> NPE). But if I obtain the logger using:
>
> Logger log = LoggerFactory.getLogger(MojitoDispatcher.class);
>
> it works smoothly.
>
> thanks again!
> Cheers,
> Janos
>
>
>
> On 24/04/2008, Tomasz Dziurko <[EMAIL PROTECTED]> wrote:
> >
> > I don't know if my solution is 'suggested-way-of-using-logger-in-t5',
> > but it's working.
> >
> > Here what you need to do:
> >
> > 0. Add to your project jars:
> > slf4j-api
> > slf4j-log4j
> > log4j // not sure if it's necessary
> > commons-logging /// not sure if it's necessary
> >
> >
> > 1. Place log4j.properties file in your <default package>
> >
> > Working example log4j.properties file:
> >
> > #####
> > log4j.rootLogger=info, stdout, R
> >
> > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> > log4j.appender.stdout.Target=System.out
> > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> > log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} [%5p] %c{1} -
> > %m%n
> >
> > log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
> > log4j.appender.R.file=example.log
> > log4j.appender.R.DatePattern='.'yyyy-MM-dd
> > log4j.appender.R.layout=org.apache.log4j.PatternLayout
> > log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} [%5p] %c{1} - %m%n
> >
> > ####
> >
> > 2. In class where you need to log something put these lines:
> >
> > import org.slf4j.Logger;
> >
> > @Inject
> > private Logger logger;
> >
> > 3. Start using it in your class
> >
> > logger.warn("some example warn info");
> >
> > That's all as I remember (don't have access to my home projects from
> > work to be 100% sure).
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to