Please forgive this note if it seems too obvious and I have misunderstood your
question/comments..

If you think of both struts and log4j as just a bunch of Java packages/classes,
then you will see that "integrating struts with log4j" is really nothing
unusual.  The log4j jar (or classes in the jar) needs a log4j.properties file
(the name of this file is most probably hard-coded in the classes in log4j jar,
which is why you don't need to personally tie the file with log4j) and this file
should therefore be in the classpath and as you have found out yourself, this is
all that is required...If for some reason you need a handle to this file, I
don't see why the usual File class in the java.io package won't do the trick..?

As for how to ensure that changes in your log4j.properties is made visible to
struts, well, I guess you'll have to restart tomcat (or your app server)..(:( I
don't believe the admin/reload.do will work (that works for changes to the
struts-config.xml and such a blessing *that* is during development!!) ..

Hope this helps,
Geeta

shankarr wrote:

> Hi!
>
> In fact, I got two responses for the question as I had sent the same
> question twice.
> My mailbox was acting funny yesterday, so I had to send it twice.
>
> Well, I do have the log4j.properties file under <web-inf>/classes
> I had thought of using the PropertyConfigurator too.
> But, when you integrate log4j with struts, we no where mention the
> log4j.properties file specifically, ie, we
> just create the file and put it under the mentioned location.
> And when we use it, we do not mention the log4j.properties file anywhere in
> the files too.
> So, how to get a handle to the file?
> Correct me if there are better approaches to the same.
>
> Steps by which I integrated are :
>
> a)Got the log4j.jar file
> b)created the log4j.properties file
> c)created commons-logging.properties file
> d) used static logger = new logger(this) in the files where this is the
> class name.
>
> TIA,
>
> Richie
>
> At 02:28 PM 1/27/2004 -0600, you wrote:
> >Do you mean changes made after the initial configuration of log4j?  You can
> >use
> >
> >         PropertyConfigurator.configureAndWatch( cfgFile, delay )
> >
> >This will load your log4j configuration file and create a thread that looks
> >for changes to the config file reloading when necessary.
> >
> >--Norm
> >
> >--
> >Norm Deane
> >MIS Consultant
> >Vanderbilt University
> >(615) 322-7855
> >[EMAIL PROTECTED]
> >
> > > -----Original Message-----
> > > From: shankarr [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, January 27, 2004 9:14 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: log4j integration
> > >
> > >
> > > Hi!
> > > I have integrated log4j with struts.
> > > I need to know how to ensure that the changes done to
> > > log4j.properties file
> > > is taken into account at run time.
> > > TIA,
> > > Richie
> > >
> > > "To achieve all that is possible, one must attempt the impossible"
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
> "To achieve all that is possible, one must attempt the impossible"


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

Reply via email to