You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ashish Kulkarni <as...@gmail.com> on 2007/10/04 20:53:24 UTC

Log file location in Web application

Hi
How do we set the log file location dyanamically in web application,
Currently i am using log4j.xml file with following definiation, this file is
under WEB-INF file
<appender name="A2" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File"
value="C:\\Documents and Settings\\Kulkara\\My
Documents\\ashish\\code\\workspace5.1M\\version6300build12-00\\log4jXmlFilter.log"
/>
... </appender>
and in load the this xml file in Servlet using
String fileName = config.getInitParameter(log4j.xml);
ServletContext oCtx = config.getServletContext();
URL path = oCtx.getResource(fileName);
DOMConfigurator.configure(path);

But if i have to install this on unix, i have to change the path, also
the server on which i will install this  may
not have the folder, so i will have to recreate a war file
So is there a dynamic way of telling log4j the location and name of log
file? which can work on any system.
i would prefer the log file to be under the same folder application is
installed

Ashish

Re: Log file location in Web application

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
Sorry i send it to wrong forum, send the question to log4j forum

Ashish

On 10/4/07, Ashish Kulkarni <as...@gmail.com> wrote:
>
> Hi
> Can you please let me know where do i look into for this information, any
> hints please
>
> Ashish
>
> On 10/4/07, Larry Meadors < lmeadors@apache.org> wrote:
> >
> > http://logging.apache.org/
> >
> > Larry
> >
> >
> > On 10/4/07, Ashish Kulkarni <as...@gmail.com> wrote:
> > > Hi
> > > How do we set the log file location dyanamically in web
> > > application,
> > >  Currently i am using log4j.xml file with following definiation, this
> > file
> > > is under WEB-INF file
> > > <appender name="A2" class="
> > > org.apache.log4j.DailyRollingFileAppender">
> > > <param name="File"
> > >  value="C:\\Documents and Settings\\Kulkara\\My
> > >
> > Documents\\ashish\\code\\workspace5.1M\\version6300build12-00\\log4jXmlFilter.log"
> >
> > > />
> > > ... </appender>
> > > and in load the this xml file in Servlet using
> > >  String fileName = config.getInitParameter(log4j.xml);
> > >  ServletContext oCtx = config.getServletContext();
> > > URL path = oCtx.getResource (fileName);
> > > DOMConfigurator.configure(path);
> > >
> > > But if i have to install this on unix, i have to change
> > > the path, also the server on which i will
> > > install this  may not have the folder, so i will have to recreate a
> > war file
> > > So is there a dynamic way of telling log4j the location and name of
> > log
> > > file? which can work on any system.
> > > i would prefer the log file to be under the same folder application is
> > > installed
> > >
> > > Ashish
> > >
> > >
> > >
> >
>
>

Re: Log file location in Web application

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
Can you please let me know where do i look into for this information, any
hints please

Ashish

On 10/4/07, Larry Meadors <lm...@apache.org> wrote:
>
> http://logging.apache.org/
>
> Larry
>
>
> On 10/4/07, Ashish Kulkarni <as...@gmail.com> wrote:
> > Hi
> > How do we set the log file location dyanamically in web
> > application,
> >  Currently i am using log4j.xml file with following definiation, this
> file
> > is under WEB-INF file
> > <appender name="A2" class="
> > org.apache.log4j.DailyRollingFileAppender">
> > <param name="File"
> >  value="C:\\Documents and Settings\\Kulkara\\My
> >
> Documents\\ashish\\code\\workspace5.1M\\version6300build12-00\\log4jXmlFilter.log"
> > />
> > ... </appender>
> > and in load the this xml file in Servlet using
> >  String fileName = config.getInitParameter(log4j.xml);
> >  ServletContext oCtx = config.getServletContext();
> > URL path = oCtx.getResource (fileName);
> > DOMConfigurator.configure(path);
> >
> > But if i have to install this on unix, i have to change
> > the path, also the server on which i will
> > install this  may not have the folder, so i will have to recreate a war
> file
> > So is there a dynamic way of telling log4j the location and name of log
> > file? which can work on any system.
> > i would prefer the log file to be under the same folder application is
> > installed
> >
> > Ashish
> >
> >
> >
>

Re: Log file location in Web application

Posted by Larry Meadors <lm...@apache.org>.
http://logging.apache.org/

Larry


On 10/4/07, Ashish Kulkarni <as...@gmail.com> wrote:
> Hi
> How do we set the log file location dyanamically in web
> application,
>  Currently i am using log4j.xml file with following definiation, this file
> is under WEB-INF file
> <appender name="A2" class="
> org.apache.log4j.DailyRollingFileAppender">
> <param name="File"
>  value="C:\\Documents and Settings\\Kulkara\\My
> Documents\\ashish\\code\\workspace5.1M\\version6300build12-00\\log4jXmlFilter.log"
> />
> ... </appender>
> and in load the this xml file in Servlet using
>  String fileName = config.getInitParameter(log4j.xml);
>  ServletContext oCtx = config.getServletContext();
> URL path = oCtx.getResource (fileName);
> DOMConfigurator.configure(path);
>
> But if i have to install this on unix, i have to change
> the path, also the server on which i will
> install this  may not have the folder, so i will have to recreate a war file
> So is there a dynamic way of telling log4j the location and name of log
> file? which can work on any system.
> i would prefer the log file to be under the same folder application is
> installed
>
> Ashish
>
>
>