Hello Mattias If you are wanting to log from a servlet, then this could help...
The GenericServlet class (a super class of HttpServlet - and therefore one that you will almost certainly be importing already) contains two log() methods. One for just a String message eg: log("we are in init()"); And one for a String with a Throwable parameter - to use as part of error handling eg: Catch(Exception e){ log("it broke because: ",e); } And those messages should end up in yr log.txt as specified in yr web.xml Try and see if you've got the api docs installed - this is where mine are: http://127.0.0.1:8080/tomcat-docs/servletapi/javax/servlet/GenericServlet.ht ml Hope that helps Steve On 5/5/02 12:42 pm, "Mattias Brändström" <[EMAIL PROTECTED]> wrote: > Hi! > > Now I have yet another question. =) > > How can I write log messages to some kind of log (preferably the one > specified by the Logger element) in a JSP-page. I have tried to write to > both System.err and System.out but nothing ends up in my log file. Is > there some special way to obtain a 'logger' object or is there some > settings in server.xml that I have missed? > > Any help would be greatly appriciated! > > Regards, > Mattias > > PS. My server.xml file is attached. > > <!-- Example Server Configuration File --> > <!-- Note that component elements are nested corresponding to their > parent-child relationships with each other --> > > <!-- A "Server" is a singleton element that represents the entire JVM, > which may contain one or more "Service" instances. The Server > listens for a shutdown command on the indicated port. > > Note: A "Server" is not itself a "Container", so you may not > define subcomponents such as "Valves" or "Loggers" at this level. > --> > > <Server port="8005" shutdown="SHUTDOWN" debug="0"> > > > <!-- A "Service" is a collection of one or more "Connectors" that share > a single "Container" (and therefore the web applications visible > within that Container). Normally, that Container is an "Engine", > but this is not required. > > Note: A "Service" is not itself a "Container", so you may not > define subcomponents such as "Valves" or "Loggers" at this level. > --> > > > <!-- The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat 4.0 > as its servlet container. Please read the README.txt file coming with > the WebApp Module distribution on how to build it. > (Or check out the "jakarta-tomcat-connectors/webapp" CVS repository) > > To configure the Apache side, you must ensure that you have the > "ServerName" and "Port" directives defined in "httpd.conf". Then, > lines like these to the bottom of your "httpd.conf" file: > > LoadModule webapp_module libexec/mod_webapp.so > WebAppConnection warpConnection warp localhost:8008 > WebAppDeploy examples warpConnection /examples/ > > The next time you restart Apache (after restarting Tomcat, if needed) > the connection will be established, and all applications you make > visible via "WebAppDeploy" directives can be accessed through Apache. > --> > > <!-- Define an Apache-Connector Service --> > <Service name="Tomcat-Apache"> > > <Connector className="org.apache.catalina.connector.warp.WarpConnector" > port="8008" minProcessors="5" maxProcessors="75" > enableLookups="true" appBase="webapps" > acceptCount="10" debug="0"/> > > <!-- Replace "localhost" with what your Apache "ServerName" is set to --> > <Engine className="org.apache.catalina.connector.warp.WarpEngine" > name="Apache" debug="0"> > > <!-- Global logger unless overridden at lower levels --> > <Logger className="org.apache.catalina.logger.FileLogger" > prefix="apache_log." suffix=".txt" > timestamp="true" verbosity="4"/> > > <!-- Because this Realm is here, an instance will be shared globally --> > <Realm className="org.apache.catalina.realm.MemoryRealm" /> > > <Host className = "org.apache.catalina.connector.warp.WarpHost" > name="www.matlaget.org" > debug="0" > appBase="matapp" > unpackWARs="true"> > > <Context path="" docBase="" debug="5" reloadable="true"/> > > </Host> > > </Engine> > > </Service> > > </Server> > > > -- > To unsubscribe: <mailto:[EMAIL PROTECTED]> > For additional commands: <mailto:[EMAIL PROTECTED]> > Troubles with the list: <mailto:[EMAIL PROTECTED]> Steven Shingler -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>