You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by ying lcs <yi...@gmail.com> on 2006/11/07 17:43:55 UTC

Using log4j in Tomcat

I have the following log4j property file, and I am using log4j in my tomcat.

Can you please tell me how can I specify the  location of the log
file so that it is in the inside the webapp directory of the tomcat
that I deploy? I don't know the location of the tomcat, so I can't put
absolute path.

log4j.appender.DLACCESS=org.apache.log4j.FileAppender

#
# how can I specify the location of the log  file so that it is in the
inside the webapp directory of the tomcat that I deploy?
#
log4j.appender.DLACCESS.File=access.log

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using log4j in Tomcat

Posted by Jacob Kjome <ho...@visi.com>.
James is correct about the fact that Tomcat sets this system property.  However,
you should be using ${catalina.base} instead of ${catalina.home}.  You may very
well have a separate instance of Tomcat with a different base directory than
that of ${catalina.home}.  In that case that you truly are running under a host
whose home is located within ${catalina.home}, ${catalina.base} will point to
the same location.  So, always use ${catalina.base} unless you have a very good
reason not to.

Jake

Quoting James Stauffer <st...@gmail.com>:

> I think log4j can resolve any system property in ${}.
> I think Tomcat usually sets that property.
>
> On 11/7/06, ying lcs <yi...@gmail.com> wrote:
> > How can log4j resolve '${catalina.home}' when it reads it from the
> > property files? And can you please tell me who will setup this
> > '${catalina.home}/'?
> > the startup script of tomcat?
> >
> >
> >
> > On 11/7/06, James Stauffer <st...@gmail.com> wrote:
> > > You can make it relative to the tomcat install by using
> > > ${catalina.home}/access.log
> > > (I assume that works in properties files but I know it does in xml
> files).
> > >
> > > On 11/7/06, ying lcs <yi...@gmail.com> wrote:
> > > > I have the following log4j property file, and I am using log4j in my
> tomcat.
> > > >
> > > > Can you please tell me how can I specify the  location of the log
> > > > file so that it is in the inside the webapp directory of the tomcat
> > > > that I deploy? I don't know the location of the tomcat, so I can't put
> > > > absolute path.
> > > >
> > > > log4j.appender.DLACCESS=org.apache.log4j.FileAppender
> > > >
> > > > #
> > > > # how can I specify the location of the log  file so that it is in the
> > > > inside the webapp directory of the tomcat that I deploy?
> > > > #
> > > > log4j.appender.DLACCESS.File=access.log
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > James Stauffer        http://www.geocities.com/stauffer_james/
> > > Are you good? Take the test at http://www.livingwaters.com/good/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> James Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using log4j in Tomcat

Posted by James Stauffer <st...@gmail.com>.
I think log4j can resolve any system property in ${}.
I think Tomcat usually sets that property.

On 11/7/06, ying lcs <yi...@gmail.com> wrote:
> How can log4j resolve '${catalina.home}' when it reads it from the
> property files? And can you please tell me who will setup this
> '${catalina.home}/'?
> the startup script of tomcat?
>
>
>
> On 11/7/06, James Stauffer <st...@gmail.com> wrote:
> > You can make it relative to the tomcat install by using
> > ${catalina.home}/access.log
> > (I assume that works in properties files but I know it does in xml files).
> >
> > On 11/7/06, ying lcs <yi...@gmail.com> wrote:
> > > I have the following log4j property file, and I am using log4j in my tomcat.
> > >
> > > Can you please tell me how can I specify the  location of the log
> > > file so that it is in the inside the webapp directory of the tomcat
> > > that I deploy? I don't know the location of the tomcat, so I can't put
> > > absolute path.
> > >
> > > log4j.appender.DLACCESS=org.apache.log4j.FileAppender
> > >
> > > #
> > > # how can I specify the location of the log  file so that it is in the
> > > inside the webapp directory of the tomcat that I deploy?
> > > #
> > > log4j.appender.DLACCESS.File=access.log
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> >
> >
> > --
> > James Stauffer        http://www.geocities.com/stauffer_james/
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using log4j in Tomcat

Posted by ying lcs <yi...@gmail.com>.
How can log4j resolve '${catalina.home}' when it reads it from the
property files? And can you please tell me who will setup this
'${catalina.home}/'?
the startup script of tomcat?



On 11/7/06, James Stauffer <st...@gmail.com> wrote:
> You can make it relative to the tomcat install by using
> ${catalina.home}/access.log
> (I assume that works in properties files but I know it does in xml files).
>
> On 11/7/06, ying lcs <yi...@gmail.com> wrote:
> > I have the following log4j property file, and I am using log4j in my tomcat.
> >
> > Can you please tell me how can I specify the  location of the log
> > file so that it is in the inside the webapp directory of the tomcat
> > that I deploy? I don't know the location of the tomcat, so I can't put
> > absolute path.
> >
> > log4j.appender.DLACCESS=org.apache.log4j.FileAppender
> >
> > #
> > # how can I specify the location of the log  file so that it is in the
> > inside the webapp directory of the tomcat that I deploy?
> > #
> > log4j.appender.DLACCESS.File=access.log
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> James Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using log4j in Tomcat

Posted by James Stauffer <st...@gmail.com>.
You can make it relative to the tomcat install by using
${catalina.home}/access.log
(I assume that works in properties files but I know it does in xml files).

On 11/7/06, ying lcs <yi...@gmail.com> wrote:
> I have the following log4j property file, and I am using log4j in my tomcat.
>
> Can you please tell me how can I specify the  location of the log
> file so that it is in the inside the webapp directory of the tomcat
> that I deploy? I don't know the location of the tomcat, so I can't put
> absolute path.
>
> log4j.appender.DLACCESS=org.apache.log4j.FileAppender
>
> #
> # how can I specify the location of the log  file so that it is in the
> inside the webapp directory of the tomcat that I deploy?
> #
> log4j.appender.DLACCESS.File=access.log
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org