This message is more appropriate for the log4j-user email list. Please post any followups to that list.
Every call to configureAndWatch() will create a thread. You only want to call the configureAndWatch() method once, in some kind of setup() or static code. You certainly do not want to call it for every logged message. -Mark > -----Original Message----- > From: Shailesh Khare, Noida [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 4:26 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: number of Thread are high. > > > > I am phasing one problem related to LOG4j if u can solve it > then pls reply > me back. > > I am logging error messages for my project using category > object. My problem > is at the time of load testing number are threads are more > the 1000 .In > normal case number of thread are 50-60.I might be using log4j > class in wrong > way are missing some thing in property file.like close, > destroy or flush the > log objects. Following is the code of my Class file which > logging messages > and find the attachment of property file used by this class > file. I and > using weblogic 6.1 Appserver.pls reply me back. > > import java.util.Hashtable; > import org.apache.log4j.Category; > import org.apache.log4j.PropertyConfigurator; > > > public class ErrorUtil > { > > static Category > cat=Category.getInstance(ErrorUtil.class.getName()); > > > private ErrorUtil() > { > > Syslogger.log(Syslogger.LOG_INFO,"ErrorUtil.ErrorUtil()","Obje ct Created"); > > } > > public static void logError(Hashtable errorMessages) > { > > Syslogger.log(Syslogger.LOG_INFO,"ErrorUtil.logError()","Called"); > > > PropertyConfigurator.configureAndWatch(EnvProps.ERRORUTIL_LOG4 > J_PROPERTY_FIL > E_PATH,1000000); > > > String logMessageString=null; > int numberOfObject=0; > > try{ > if(errorMessages.containsKey("client_ip")) > > logMessageString=(String)errorMessages.get("client_ip"); > if(errorMessages.containsKey("user_agent")) > > logMessageString=logMessageString+","+ > (String)errorMessages.get("user_agent"); > if(errorMessages.containsKey("session_id")) > logMessageString= > logMessageString +"," + (String)errorMessages.get("session_id"); > if(errorMessages.containsKey("weblogic_server_id")) > logMessageString= > logMessageString +","+ > (String)errorMessages.get("weblogic_server_id"); > if(errorMessages.containsKey("session_creation_time")) > logMessageString= > logMessageString +"," + > (String)errorMessages.get("session_creation_time"); > if(errorMessages.containsKey("error_message")) > logMessageString= > logMessageString +"," + (String)errorMessages.get("error_message"); > if(errorMessages.containsKey("error_code")) > logMessageString= > logMessageString +"," + (String)errorMessages.get("error_code"); > if(errorMessages.containsKey("customer_id")) > logMessageString= > logMessageString +"," + (String)errorMessages.get("customer_id"); > if(errorMessages.containsKey("NumberOfObject")) > numberOfObject= > Integer.parseInt((String)errorMessages.get("NumberOfObject")); > > // Any objects attached to the session > for(int > count=1;count<=numberOfObject;count++) > { > > > > if(errorMessages.containsKey("objectName"+count)) > { > > logMessageString= > logMessageString + "," +errorMessages.get("objectName"+count); > } > > > if(errorMessages.containsKey("objectValue"+count)) > { > > logMessageString= > logMessageString + "," + errorMessages.get("objectValue"+count); > } > > }//End of for loop. > > > cat.error(logMessageString); > Syslogger.log(Syslogger.LOG_INFO,"ErrorUtil.logError()","Error > Message has > been written into log file"); > } > catch(Exception e) > { > > Syslogger.log(Syslogger.LOG_ERR,"ErrorUtil.logError()",e.toString()); > } > }//end of method logError(). > > //This method is for parsing Exception Messages. > > }//End of class. > > > > Regards, > Shailesh khare > HCL Tech,Noida. > Tel:4516321 ext: 1095. > > ______________________________________________________________ > ______________ > _ > DISCLAIMER: > This email and any files transmitted with it are confidential and are > intended solely for the use of the individual or entity to > whom they are > addressed. This communication represents the originator's > personal views and > opinions, which do not necessarily reflect those of HCL > Technologies. If you > are not the original recipient or the person responsible for > delivering the > email to the intended recipient, be advised that you have > received this > email in error, and that any use, dissemination, forwarding, > printing, or > copying of this email is strictly prohibited. If you received > this email in > error, please immediately notify [EMAIL PROTECTED] > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>