Date: Wednesday, April 19, 2006 @ 08:54:27
Author: csaba
Path: /cvsroot/carob/libmysequoia
Modified: include/CarobMySQL.hpp (1.32 -> 1.33) src/CarobMySQL.cpp (1.72
-> 1.73) src/MySQLAPI.cpp (1.53 -> 1.54)
Read the config directory from the LIBMYSEQUOIA_CONF_DIR if set otherwise use
the compile time defaults. Fixes LMS-12
------------------------+
include/CarobMySQL.hpp | 5 +++--
src/CarobMySQL.cpp | 13 +++++++++++--
src/MySQLAPI.cpp | 20 +++++++++++++++++---
3 files changed, 31 insertions(+), 7 deletions(-)
Index: libmysequoia/include/CarobMySQL.hpp
diff -u libmysequoia/include/CarobMySQL.hpp:1.32
libmysequoia/include/CarobMySQL.hpp:1.33
--- libmysequoia/include/CarobMySQL.hpp:1.32 Tue Mar 28 14:25:11 2006
+++ libmysequoia/include/CarobMySQL.hpp Wed Apr 19 08:54:27 2006
@@ -43,9 +43,10 @@
const unsigned long MYSEQUOIA_MAGIC = 0xC00CA10B;
-#define LOGGER_CONFIG_FILE CONFIGFILE_DIR"/logger.conf"
+#define LOGGER_CONFIG_FILE "logger.conf"
#define MYSEQUOIA_CONFIG_FILE "mysequoia.conf"
-#define GLOBAL_MYSEQUOIA_CONFIG_FILE CONFIGFILE_DIR"/"MYSEQUOIA_CONFIG_FILE
+#define DEFAULT_LOGGER_CONFIG_FILE CONFIGFILE_DIR"/"LOGGER_CONFIG_FILE
+#define DEFAULT_MYSEQUOIA_CONFIG_FILE CONFIGFILE_DIR"/"MYSEQUOIA_CONFIG_FILE
class CarobStmt;
Index: libmysequoia/src/CarobMySQL.cpp
diff -u libmysequoia/src/CarobMySQL.cpp:1.72
libmysequoia/src/CarobMySQL.cpp:1.73
--- libmysequoia/src/CarobMySQL.cpp:1.72 Tue Apr 18 11:50:34 2006
+++ libmysequoia/src/CarobMySQL.cpp Wed Apr 19 08:54:27 2006
@@ -1087,18 +1087,27 @@
char *group;
char *home_dir = getenv("HOME");
+ char *conf_dir = getenv("LIBMYSEQUOIA_CONF_DIR");
IniParser ini;
/*
* The order of reading the config files:
- * 1. /etc/
+ * 1. LIBMYSEQUOIA_CONF_DIR env variable or /etc/mysequoia if not set
* 2. "~/"
* 3. ""
* 4. user supplied options.my_cnf_file
*/
/* 1 */
- ini.parseFile(GLOBAL_MYSEQUOIA_CONFIG_FILE);
+ if (conf_dir)
+ {
+ string s = string(conf_dir) + "/" + MYSEQUOIA_CONFIG_FILE;
+ ini.parseFile(s.c_str());
+ }
+ else
+ {
+ ini.parseFile(DEFAULT_MYSEQUOIA_CONFIG_FILE);
+ }
/* 2 */
if (home_dir)
Index: libmysequoia/src/MySQLAPI.cpp
diff -u libmysequoia/src/MySQLAPI.cpp:1.53 libmysequoia/src/MySQLAPI.cpp:1.54
--- libmysequoia/src/MySQLAPI.cpp:1.53 Fri Mar 24 13:59:31 2006
+++ libmysequoia/src/MySQLAPI.cpp Wed Apr 19 08:54:27 2006
@@ -41,6 +41,9 @@
/* C lib includes */
#include <climits>
+#include <cstdlib>
+
+#include <string>
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -150,10 +153,21 @@
mysql_server_init (int argc, char **argv, char **groups)
{
library_init.lock();
-
- // initialize logging
- PropertyConfigurator::configure(LOGGER_CONFIG_FILE);
+ char *conf_dir = getenv("LIBMYSEQUOIA_CONF_DIR");
+
+ // initialize logging
+ if (conf_dir)
+ {
+ std::string s = std::string(conf_dir) + "/" + LOGGER_CONFIG_FILE;
+
+ PropertyConfigurator::configure(s.c_str());
+ }
+ else
+ {
+ PropertyConfigurator::configure(DEFAULT_LOGGER_CONFIG_FILE);
+ }
+
LOG4CXX_DEBUG(logger, "Entering mysql_server_init: argc=" << argc << "
argv=" << argv << " groups=" << groups);
CarobNS::setLogLevel(CarobNS::LOG_LEVEL_OFF);
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits