dcsimg
Log4J - Can find the Properties file, but NO OUTPUT written
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gary_McSwain
Posted On:   Thursday, February 5, 2004 07:57 PM

I signed up this week with an ISP that uses Tomcat. My old ISP used Resin and my Log4j code worked perfect. Now with Tomcat it fails. I have confirmed that the properties file exists, but it must not be getting read properly because I never get any OUTPUT written to the log file. I have tried all sorts or combinations of the path and the log4j.log output file never gets written anywhere. I am using log4j-1.2.7.jar Is there anything special that I have to use for Tomcat? Do you think the properties file is not being parsed properly? Does the log4j.appender.A1.file=... require any specific format other than what I am using? Does the output log file have to be created in the /log directory or will Log4j creat   More>>

I signed up this week with an ISP that uses Tomcat. My old ISP used Resin and my Log4j code worked perfect. Now with Tomcat it fails.

I have confirmed that the properties file exists, but it must not be getting read properly because I never get any OUTPUT written to the log file.


I have tried all sorts or combinations of the path and the log4j.log output file never gets written anywhere.


I am using log4j-1.2.7.jar


Is there anything special that I have to use for Tomcat?


Do you think the properties file is not being parsed properly?


Does the log4j.appender.A1.file=... require any specific format other than what I am using?


Does the output log file have to be created in the /log directory or will Log4j create it? I have tried it both ways and it never gets written or created.



Below is the doPost() from the Servlet that I am using to test



THANKS for any help you can give me!!!





 




			
import org.apache.log4j.*;

public class test_log4j extends HttpServlet
{
static Logger logger = Logger.getLogger(test_log4j.class.getName());

public void init(ServletConfig cfg) throws ServletException
{
super.init(cfg);
}

public void destroy()
{
super.destroy();
}

public void doPost(HttpServletRequest req, HttpServletResponse resp)
{
PropertyConfigurator.configure("/home/southwind/public_html/WEB-INF/dat/log4j.dat");

logger.debug(" Test Debug ");
logger.warn(" Test Warn ");
logger.fatal(" Test Fatal");
}
}



 


This is my Properties file



			
log4j.rootCategory=DEBUG, A1
log4j.appender.A1=org.apache.log4j.RollingFileAppender

log4j.appender.A1.file=/home/southwind/public_html/WEB-INF/log/log4j.log

log4j.appender.A1.append=true

log4j.appender.A1.layout=org.apache.log4j.PatternLayout

log4j.appender.A1.layout.ConversionPattern=%n%-5p %d{ISO8601} - %F(%L) - [%m]

   <<Less
About | Sitemap | Contact