You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sg...@gmx.net on 2001/04/03 17:47:41 UTC

tomcat without apache logging & security

Hi
I installed Tomcat 3.2.1 (without Apache !) on my Linux machine and made two
java servlets that are querying my postgres db and display a web page with
the data. Both servlets run fine. However, being a beginner, I can't figure
out or find helpful documentation on the following two questions :

I would like to log all the queries to the database in logs/servlet.log. I
put the verbosityLevel to DEBUG which didn't seem to have an effect on the
logfile (it only logs the init calls). In server.xml, there are all these
ContextInterceptors that I suspect to be helpful (?), but I have no idea how to use
or modify them. If you have some explanation or suggestions or know some
documentation "for dummies" I would be very grateful :-)

The other thing is the security. I would like to restrict the access to ONE
of the two servlets to a couple of IP addresses. Does Tomcat offer a
possibility for that ? I saw that by modifying the tomcat.policy file I can do IP
filtering, but that concerns all the servlets !?

Thanks a lot for any help !!
Silvia

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


Re: tomcat without apache logging & security

Posted by sg...@gmx.net.
Thanks, it works fine like that :-)

> On Tuesday 03 April 2001 10:47, sgoni@gmx.net wrote:
> >
> > I would like to log all the queries to the database in logs/servlet.log.
> I
> > put the verbosityLevel to DEBUG which didn't seem to have an effect on
> the
> > logfile (it only logs the init calls). In server.xml, there are all
> these
> > ContextInterceptors that I suspect to be helpful (?), but I have no idea
> > how to use or modify them. If you have some explanation or suggestions
> or
> > know some documentation "for dummies" I would be very grateful :-)
> What you need to do is use log statements in your Java code
> In your Java code, obtain the servlet context, and then write a log
> statement along the lines of:
> servletContext.log("Querying the database");
> Any logging you do using the servlet API's logging facility will end up in
> 
> Tomcat's servlet log.
> Check the Javadoc for the servlet API for more info.
> -- 
> 
> Ed Gomolka
> (egomolka@gyldan.com)
> 

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


Re: tomcat without apache logging & security

Posted by Ed Gomolka <eg...@gyldan.com>.
On Tuesday 03 April 2001 10:47, sgoni@gmx.net wrote:
>
> I would like to log all the queries to the database in logs/servlet.log. I
> put the verbosityLevel to DEBUG which didn't seem to have an effect on the
> logfile (it only logs the init calls). In server.xml, there are all these
> ContextInterceptors that I suspect to be helpful (?), but I have no idea
> how to use or modify them. If you have some explanation or suggestions or
> know some documentation "for dummies" I would be very grateful :-)
What you need to do is use log statements in your Java code
In your Java code, obtain the servlet context, and then write a log
statement along the lines of:
servletContext.log("Querying the database");
Any logging you do using the servlet API's logging facility will end up in 
Tomcat's servlet log.
Check the Javadoc for the servlet API for more info.
-- 

Ed Gomolka
(egomolka@gyldan.com)

Re: change of webapps directory

Posted by Christian Seifert <cs...@yahoo.com>.
well, sure I can do this, but then the mechanism for
extracting war files does not work anymore. 
Christian
--- Anuj Agrawal <ag...@lucent.com> wrote:
> You have to add a new context in the server.xml file
> (in conf dir).  There are other
> examples in there to copy from. ;)
> Anuj.
> 
> Christian Seifert wrote:
> 
> >        I am deploying war files and it seems as if
> those must be stuck into the
> > $TOMCAT_HOME/webapps directory. Is there any way
> to specify a different
> > location of this webapps directory?
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: change of webapps directory

Posted by Anuj Agrawal <ag...@lucent.com>.
You have to add a new context in the server.xml file (in conf dir).  There are other
examples in there to copy from. ;)
Anuj.

Christian Seifert wrote:

>        I am deploying war files and it seems as if those must be stuck into the
> $TOMCAT_HOME/webapps directory. Is there any way to specify a different
> location of this webapps directory?


change of webapps directory

Posted by Christian Seifert <cs...@yahoo.com>.
Hi,
	I am deploying war files and it seems as if those must be stuck into the
$TOMCAT_HOME/webapps directory. Is there any way to specify a different
location of this webapps directory?
Thanks

Christian


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: tomcat without apache logging & security

Posted by Kevin Sangeelee <ke...@susa.net>.
On Tue, 3 Apr 2001 sgoni@gmx.net wrote:

> The other thing is the security. I would like to restrict the access to ONE
> of the two servlets to a couple of IP addresses. Does Tomcat offer a
> possibility for that ? I saw that by modifying the tomcat.policy file I can do IP
> filtering, but that concerns all the servlets !?

You could compare the String result of request.getRemoteAddr() to the IP
addresses you want to restrict to on the doGet() or doPost() methods of
your servlet. The addresses could be specified in the servlet's properties
in web.xml

Kevin