You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/03/14 20:24:28 UTC
svn commit: r518284 -
/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/JMeterUtils.java
Author: sebb
Date: Wed Mar 14 12:24:27 2007
New Revision: 518284
URL: http://svn.apache.org/viewvc?view=rev&rev=518284
Log:
Start to add logfile option
INCOMPLETE
Modified:
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/JMeterUtils.java
Modified: jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/JMeterUtils.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/JMeterUtils.java?view=diff&rev=518284&r1=518283&r2=518284
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/JMeterUtils.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/JMeterUtils.java Wed Mar 14 12:24:27 2007
@@ -95,11 +95,57 @@
* even reside in the user space, or in the classpath under
* org.apache.jmeter.jmeter.properties.
*
+ * The method also initialises logging and sets up the default Locale
+ *
+ * TODO - perhaps remove?
+ * [still used
+ *
* @param file
* the file to load
* @return the Properties from the file
*/
public static Properties getProperties(String file) {
+ loadJMeterProperties(file);
+ initLogging();
+ initLocale();
+ return appProperties;
+ }
+
+ /**
+ * Initialise JMeter logging
+ */
+ public static void initLogging() {
+ LoggingManager.initializeLogging(appProperties);
+ log = LoggingManager.getLoggerForClass();
+ }
+
+ /**
+ * Initialise the JMeter Locale
+ */
+ public static void initLocale() {
+ String loc = appProperties.getProperty("language"); // $NON-NLS-1$
+ if (loc != null) {
+ String []parts = JOrphanUtils.split(loc,"_");// $NON-NLS-1$
+ if (parts.length==2) {
+ setLocale(new Locale(parts[0], parts[1]));
+ } else {
+ setLocale(new Locale(loc, "")); // $NON-NLS-1$
+ }
+
+ } else {
+ setLocale(Locale.getDefault());
+ }
+ }
+
+
+ /**
+ * Load the JMeter properties file; if not found, then
+ * default to "org/apache/jmeter/jmeter.properties" from the classpath
+ *
+ * c.f. loadProperties
+ *
+ */
+ public static void loadJMeterProperties(String file) {
Properties p = new Properties(System.getProperties());
InputStream is = null;
try {
@@ -121,21 +167,6 @@
JOrphanUtils.closeQuietly(is);
}
appProperties = p;
- LoggingManager.initializeLogging(appProperties);
- log = LoggingManager.getLoggerForClass();
- String loc = appProperties.getProperty("language"); // $NON-NLS-1$
- if (loc != null) {
- String []parts = JOrphanUtils.split(loc,"_");// $NON-NLS-1$
- if (parts.length==2) {
- setLocale(new Locale(parts[0], parts[1]));
- } else {
- setLocale(new Locale(loc, "")); // $NON-NLS-1$
- }
-
- } else {
- setLocale(Locale.getDefault());
- }
- return p;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org