dcsimg
Accessing Log4j from Struts
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sam_aggarwal
Posted On:   Friday, June 20, 2003 08:45 AM

Trying to access Log4j from inside my Action class: I keep getting "java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)" Although the "log4j.properties" is inside "WEB-INF/classes" What am I doing wrong...This may be irrelevant..I am using WSAD5 Here's the code I use. Logger logger = Logger.getLogger(SubmitAction.class.getName()) ; try { PropertyConfigurator.configure("log4j.properties"); // Logging if (logger.isInfoEnabled()){ logger.info("Test logging from inside SubmitAction") ; }    More>>

Trying to access Log4j from inside my Action class:

I keep getting "java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)"

Although the "log4j.properties" is inside "WEB-INF/classes"

What am I doing wrong...This may be irrelevant..I am using WSAD5

Here's the code I use.


Logger logger = Logger.getLogger(SubmitAction.class.getName()) ;


try {



PropertyConfigurator.configure("log4j.properties");


// Logging
if (logger.isInfoEnabled()){

logger.info("Test logging from inside SubmitAction") ;

}

   <<Less

Re: Accessing Log4j from Struts

Posted By:   sam_aggarwal  
Posted On:   Friday, June 20, 2003 12:42 PM

Well it started working :


1) I removed the line "PropertyConfigurator.configure("log4j.properties"); "...so by default it looks for log4j.properties file inside the "Web Content " folder & works.

putting this file in any other folder doesn't work...STRANGE since all the other folders are also part of classpath.(...WSAD FUN stuff)

About | Sitemap | Contact