dcsimg
Using commons-logging and log4j
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   lydia_p
Posted On:   Monday, February 10, 2003 06:44 AM

I have set up my Struts application to use commons-logging - I can see the log messages on the console from my code. I have now changed my commons-logging.properties file to read: org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JCategoryLog And have added a log4j.xml file with the following category and appender: Created a Log4JServlet class that points to the log4j.xml file and added it to the web.xml file. In my action class, I import the following: import org.apache.commons.logging.*; The code looks like such: static Log log = LogFactory.getLog(ListAction.c   More>>

I have set up my Struts application to use commons-logging - I can see the log messages on the console from my code.


I have now changed my commons-logging.properties file to read:

org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JCategoryLog


And have added a log4j.xml file with the following category
and appender:

			








Created a Log4JServlet class that points to the log4j.xml file and added it to the web.xml file.


In my action class, I import the following:

import org.apache.commons.logging.*;


The code looks like such:

			
static Log log = LogFactory.getLog(ListAction.class);
.
.
log.debug=("start of ListAction");
log.info=("testing an INFO message");


I see the log messages going to the console with no problems but my log file itself is empty. What am I missing?!?!?!
Do I have to initialize a log4j logging category in my ListAction class? (I tried that and it works fine) I would
like to make this completely pluggable/unpluggable - so that
if one person wants to use JRAS instead of log4j, they can do so with a minimum of pain.....

Help appreciated!!!    <<Less
About | Sitemap | Contact