Hi all, I'm a beginner to web application
I tried to create a simple web application, namely WebTest. It only contains
one servlet, like this:

    quote:
    package solmit;

    import java.io.IOException;
    import java.io.PrintWriter;

    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.apache.log4j.Logger;;

    public class WebTest extends HttpServlet {
    private static Logger log = Logger.getLogger(WebTest.class);

    public void doGet(HttpServletRequest request, HttpServletResponse
response)
    throws IOException, ServletException
    {
    log.debug("anas: about to enter doGet");
    response.setContentType("text/html");
    PrintWriter writer = response.getWriter();

    writer.println("<html><head><title>Simple Web
Application</title></head>");
    writer.println("<body><h1>A Simple Web Application</h1>");
    writer.println("Here's some text...<br>...and a bit more text");
    writer.println("</body></html>");
    log.debug("anas: about to leave doGet");
    }
    }

My web.xml file looks like this:
     
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
        <display-name>WebTest</display-name>
        <welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.jsp</welcome-file>
                <welcome-file>default.html</welcome-file>
                <welcome-file>default.htm</welcome-file>
                <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>
        <servlet>
                <servlet-name>some dummy name</servlet-name>
                <servlet-class>solmit.WebTest</servlet-class>
        </servlet>
        <servlet-mapping>
                <servlet-name>some dummy name</servlet-name>
                <url-pattern>/start-web-test</url-pattern>
        </servlet-mapping>
    </web-app>
     
I also created log4j.properties file in <web-app>/WEB-INF/classes directory.
It contains the following code:
        
    log4j.logger.solmit=ALL, A
    log4j.logger.org.apache=OFF, A
     
    log4j.appender.A=org.apache.log4j.ConsoleAppender
    log4j.appender.A.layout=org.apache.log4j.PatternLayout
     log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n 


I packaged this application into WebTest.war.
When I dropped this package into my Tomcat (Tomcat 5.5), and tried to access
web app using this url :http://localhost:8080/WebTest/start-web-test
I got error messages on my stderr_20080522 log:

        
    log4j:WARN No appenders could be found for logger
(org.apache.catalina.startup.Embedded).
    log4j:WARN Please initialize the log4j system properly.


Oh, I've also dropped log4j-1.2.13.jar and commons-logging-1.0.4.jar on
Tomcat/common/lib
I've read tomcat documentation on logging.. but it seems that it doesn't
give me some clue to use log4j logging in my application
("http://localhost:8080/tomcat-docs/logging.html";)
I've also already read the documentation about log4j on
"http://www.laliluna.de/log4j-tutorial.html";

What the error actually means. ??
How do we setup tomcat to use log4j for logging ??
Any help would be greatly appreciated..
Thanks

My computer spec:
Tomcat 5.5
Jre 1.5.0_15
Windows XP Prof edition

-- 
View this message in context: 
http://www.nabble.com/Error-using-log4j-in-Tomcat-5.5-tp17400689p17400689.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to