1 package net.sourceforge.jdbclogger.core.config; 2 18 import net.sourceforge.jdbclogger.core.util.ConfigHelper; 19 import org.apache.commons.logging.Log; 20 import org.apache.commons.logging.LogFactory; 21 22 import java.io.IOException ; 23 import java.io.InputStream ; 24 import java.util.Properties ; 25 26 30 public class Environment 31 { 32 private static final Log log = LogFactory.getLog(Environment.class); 33 private static Properties GLOBAL_PROPERTIES = new Properties (); 34 35 static 36 { 37 InputStream stream = ConfigHelper.getResourceAsStream("/" + JdbcLoggerConstants.USER_CONFIG_FILE_NAME); 38 try 39 { 40 GLOBAL_PROPERTIES.load(stream); 41 } 42 catch (Exception exc) 43 { 44 log.error("problem loading properties from jdbclogger.properties", exc); 45 } 46 finally 47 { 48 try 49 { 50 if (stream != null) stream.close(); 51 } 52 catch (IOException exc) 53 { 54 log.error("could not close stream on jdbclogger.properties", exc); 55 } 56 } 57 GLOBAL_PROPERTIES.putAll(System.getProperties()); 59 } 60 61 65 public static Properties getProperties() 66 { 67 Properties copy = new Properties (); 68 copy.putAll(GLOBAL_PROPERTIES); 69 return copy; 70 } 71 } 72 | Popular Tags |