[jboss-dev-forums] [Javassist development Forum] - How to use Log4j in Struts

ashish.mishra16 do-not-reply at jboss.com
Wed Jan 31 00:29:52 EST 2007


 I m facing problem in using log4j in my struts application. My director strutcture is 
SRC,Web-Root
             WEB-INF
                   lib,classes,web.xml,struts-config.xml
                           In classes i have class files, config.properties for log4j, ApplicationResources.properties.

Now i m not able to read the config.properties file. in any ways, the config.properties file is like this:

log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n.

I m using the following method to read the it in LoginAction.java:

static Logger logger = Logger.getLogger(LoginAction.class.getName());
try {
			
	Properties logProperties = new Properties();
	logProperties.load(new FileInputStream("config.properties"));
	PropertyConfigurator.configure(logProperties);				
      } catch (Exception e) {
      
      throw new RuntimeException("Enable to Load Logging Properties File");
      }
Please tell me how to read the config.properties file. Or what is d other ways to handle Log4J. 




         

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008650#4008650

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008650



More information about the jboss-dev-forums mailing list