Howdy, >the methods of org.apache.catalina.logger.FileLogger or log4j's Logger >class so that i can turn logging on and off and can use various levels like >debug,info,warn,errors etc. I tried to import >org.apache.catalina.logger.FileLogger in java servlet, but it says class >not found. I do have commons-logging under <server-root>/common/lib folder. >Please guide me where am i going wrong? also if anyone who has log4j under
Don't use tomcat's internal Logger facilities, as they are container-specific. Instead, choose between using log4j by yourself or using the commons-logging that's included with tomcat. If you want to use commons-logging, in your servlet: import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; Declare a private static Log: private static Log theLog; Then in the init() method of your servlet, or in static initialization: theLog = LogFactory.getLog(getClass()); Now you can use it. For more details, read the commons-logging documentation. If you want to use log4j directly, the code is fairly similar to the above, except you don't need a LogFactory, you just have org.apache.log4j.Logger and its getLogger(...) call. You will need to configure log4j (read its docs for how to do this) or commons-logging (read its docs for how to do this) if you find tomcat's default configuration insufficient (as you likely will). Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
