Commit ea22809a authored by Pavel Vainerman's avatar Pavel Vainerman

1) DBServer: сделал вывод лога в LEVEL9

2) Исправил ошибки недолиньковки библиотек выдаваемые новым компилятором
parent 6ab1a0cc
...@@ -6,7 +6,8 @@ uniset_mbrtutest_SOURCES = mbrtutester.cc ...@@ -6,7 +6,8 @@ uniset_mbrtutest_SOURCES = mbrtutester.cc
uniset_mbrtutest_LDADD = $(top_builddir)/lib/libUniSet.la uniset_mbrtutest_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_mbtcptest_SOURCES = mbtcptester.cc uniset_mbtcptest_SOURCES = mbtcptester.cc
uniset_mbtcptest_LDADD = $(top_builddir)/lib/libUniSet.la uniset_mbtcptest_LDADD = $(top_builddir)/lib/libUniSet.la $(COMCPP_LIBS)
uniset_mbtcptest_CPPFLAGS = $(COMCPP_CFLAGS)
uniset_mbrtuslave_echo_SOURCES = MBSlave.cc mbrtuslave.cc uniset_mbrtuslave_echo_SOURCES = MBSlave.cc mbrtuslave.cc
uniset_mbrtuslave_echo_LDADD = $(top_builddir)/lib/libUniSet.la $(SIGC_LIBS) uniset_mbrtuslave_echo_LDADD = $(top_builddir)/lib/libUniSet.la $(SIGC_LIBS)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Name: libuniset Name: libuniset
Version: 1.3 Version: 1.3
Release: alt18 Release: alt19
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
License: GPL License: GPL
Group: Development/C++ Group: Development/C++
...@@ -213,6 +213,10 @@ rm -f %buildroot%_libdir/*.la ...@@ -213,6 +213,10 @@ rm -f %buildroot%_libdir/*.la
%changelog %changelog
* Thu May 31 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt19
- DBServer: set log info level - LEVEL9
- minor fixies for linker errors (new gcc)
* Tue Apr 10 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt18 * Tue Apr 10 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt18
- fixed bug in ComPort485F (reinit function) - fixed bug in ComPort485F (reinit function)
......
...@@ -240,11 +240,13 @@ void DBServer_MySQL::parse( UniSetTypes::ConfirmMessage* am ) ...@@ -240,11 +240,13 @@ void DBServer_MySQL::parse( UniSetTypes::ConfirmMessage* am )
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
bool DBServer_MySQL::writeToBase( const string& query ) bool DBServer_MySQL::writeToBase( const string& query )
{ {
unideb[Debug::INFO] << "DBServer_MySQL: " << query << endl; if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << "DBServer_MySQL: " << query << endl;
// cout << "DBServer_MySQL: " << query << endl; // cout << "DBServer_MySQL: " << query << endl;
if( !db || !connect_ok ) if( !db || !connect_ok )
{ {
unideb[Debug::CRIT] << myname << "(writeToBase): соединение с БД не установлено\n" if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(writeToBase): соединение с БД не установлено\n"
<< myname << "(writeToBase): lost query: " << myname << "(writeToBase): lost query: "
<< query << endl; << query << endl;
return false; return false;
...@@ -315,17 +317,20 @@ void DBServer_MySQL::parse( UniSetTypes::SensorMessage *si ) ...@@ -315,17 +317,20 @@ void DBServer_MySQL::parse( UniSetTypes::SensorMessage *si )
if( !writeToBase("INSERT INTO "+table+data.str()) ) if( !writeToBase("INSERT INTO "+table+data.str()) )
{ {
unideb[Debug::CRIT] << myname << "(insert) sensor msg error: "<< db->error() << endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(insert) sensor msg error: "<< db->error() << endl;
db->freeResult(); db->freeResult();
} }
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
unideb[Debug::CRIT] << myname << "(parse SensorMessage): " << ex << endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(parse SensorMessage): " << ex << endl;
} }
catch( ... ) catch( ... )
{ {
unideb[Debug::CRIT] << myname << "(parse SensorMessage): неизвестное исключние..." << endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(parse SensorMessage): неизвестное исключние..." << endl;
} }
} }
...@@ -333,7 +338,8 @@ void DBServer_MySQL::parse( UniSetTypes::SensorMessage *si ) ...@@ -333,7 +338,8 @@ void DBServer_MySQL::parse( UniSetTypes::SensorMessage *si )
void DBServer_MySQL::init_dbserver() void DBServer_MySQL::init_dbserver()
{ {
DBServer::init_dbserver(); DBServer::init_dbserver();
unideb[Debug::INFO] << myname << "(init): ..." << endl; if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): ..." << endl;
if( connect_ok ) if( connect_ok )
{ {
...@@ -355,7 +361,7 @@ void DBServer_MySQL::init_dbserver() ...@@ -355,7 +361,7 @@ void DBServer_MySQL::init_dbserver()
if( !node ) if( !node )
throw NameNotFound(string(myname+"(init): в конфигурационном файле не найден раздел LocalDBServer")); throw NameNotFound(string(myname+"(init): в конфигурационном файле не найден раздел LocalDBServer"));
unideb[Debug::INFO] << myname << "(init): инициализируем соединение" << endl; unideb[DBLogInfoLevel] << myname << "(init): инициализируем соединение" << endl;
string dbname(conf->getProp(node,"dbname")); string dbname(conf->getProp(node,"dbname"));
string dbnode(conf->getProp(node,"dbnode")); string dbnode(conf->getProp(node,"dbnode"));
string user(conf->getProp(node,"dbuser")); string user(conf->getProp(node,"dbuser"));
...@@ -371,7 +377,8 @@ void DBServer_MySQL::init_dbserver() ...@@ -371,7 +377,8 @@ void DBServer_MySQL::init_dbserver()
if( dbnode.empty() ) if( dbnode.empty() )
dbnode = "localhost"; dbnode = "localhost";
unideb[Debug::INFO] << myname << "(init): connect dbnode=" << dbnode if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): connect dbnode=" << dbnode
<< "\tdbname=" << dbname << "\tdbname=" << dbname
<< " pingTime=" << PingTime << " pingTime=" << PingTime
<< " ReconnectTime=" << ReconnectTime << endl; << " ReconnectTime=" << ReconnectTime << endl;
...@@ -379,7 +386,8 @@ void DBServer_MySQL::init_dbserver() ...@@ -379,7 +386,8 @@ void DBServer_MySQL::init_dbserver()
if( !db->connect(dbnode, user, password, dbname) ) if( !db->connect(dbnode, user, password, dbname) )
{ {
// ostringstream err; // ostringstream err;
unideb[Debug::CRIT] << myname if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname
<< "(init): не смог создать соединение с БД err:\n" << "(init): не смог создать соединение с БД err:\n"
<< db->error() << endl; << db->error() << endl;
// throw Exception( string(myname+"(init): не смогли создать соединение с БД "+db->error()) ); // throw Exception( string(myname+"(init): не смогли создать соединение с БД "+db->error()) );
...@@ -387,7 +395,8 @@ void DBServer_MySQL::init_dbserver() ...@@ -387,7 +395,8 @@ void DBServer_MySQL::init_dbserver()
} }
else else
{ {
unideb[Debug::INFO] << myname << "(init): connect ok\n"; if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(init): connect ok\n";
connect_ok = true; connect_ok = true;
askTimer(DBServer_MySQL::ReconnectTimer,0); askTimer(DBServer_MySQL::ReconnectTimer,0);
askTimer(DBServer_MySQL::PingTimer,PingTime); askTimer(DBServer_MySQL::PingTimer,PingTime);
...@@ -402,7 +411,8 @@ void DBServer_MySQL::createTables( DBInterface *db ) ...@@ -402,7 +411,8 @@ void DBServer_MySQL::createTables( DBInterface *db )
UniXML_iterator it( conf->getNode("Tables") ); UniXML_iterator it( conf->getNode("Tables") );
if(!it) if(!it)
{ {
unideb[Debug::CRIT] << myname << ": не найден раздел Tables...."<< endl; if( unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << ": не найден раздел Tables...."<< endl;
throw Exception(); throw Exception();
} }
...@@ -410,10 +420,11 @@ void DBServer_MySQL::createTables( DBInterface *db ) ...@@ -410,10 +420,11 @@ void DBServer_MySQL::createTables( DBInterface *db )
{ {
if( it.getName() != "comment" ) if( it.getName() != "comment" )
{ {
unideb[Debug::INFO] << myname << "(createTables): создаем " << it.getName() << endl; if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(createTables): создаем " << it.getName() << endl;
ostringstream query; ostringstream query;
query << "CREATE TABLE " << conf->getProp(it,"name") << "(" << conf->getProp(it,"create") << ")"; query << "CREATE TABLE " << conf->getProp(it,"name") << "(" << conf->getProp(it,"create") << ")";
if( !db->query(query.str()) ) if( !db->query(query.str()) && unideb.debugging(Debug::CRIT) )
unideb[Debug::CRIT] << myname << "(createTables): error: \t\t" << db->error() << endl; unideb[Debug::CRIT] << myname << "(createTables): error: \t\t" << db->error() << endl;
} }
} }
...@@ -427,7 +438,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm ) ...@@ -427,7 +438,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
{ {
if( !db->ping() ) if( !db->ping() )
{ {
unideb[Debug::WARN] << myname << "(timerInfo): потеряно соединение с сервером БД" << endl; if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): потеряно соединение с сервером БД" << endl;
connect_ok = false; connect_ok = false;
askTimer(DBServer_MySQL::PingTimer,0); askTimer(DBServer_MySQL::PingTimer,0);
askTimer(DBServer_MySQL::ReconnectTimer,ReconnectTime); askTimer(DBServer_MySQL::ReconnectTimer,ReconnectTime);
...@@ -435,14 +447,16 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm ) ...@@ -435,14 +447,16 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
else else
{ {
connect_ok = true; connect_ok = true;
unideb[Debug::INFO] << myname << "(timerInfo): DB ping ok\n"; if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(timerInfo): DB ping ok\n";
} }
} }
break; break;
case DBServer_MySQL::ReconnectTimer: case DBServer_MySQL::ReconnectTimer:
{ {
unideb[Debug::INFO] << myname << "(timerInfo): reconnect timer" << endl; if( unideb.debugging(DBLogInfoLevel) )
unideb[DBLogInfoLevel] << myname << "(timerInfo): reconnect timer" << endl;
if( db->isConnection() ) if( db->isConnection() )
{ {
if( db->ping() ) if( db->ping() )
...@@ -452,7 +466,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm ) ...@@ -452,7 +466,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
askTimer(DBServer_MySQL::PingTimer,PingTime); askTimer(DBServer_MySQL::PingTimer,PingTime);
} }
connect_ok = false; connect_ok = false;
unideb[Debug::WARN] << myname << "(timerInfo): нет связи с БД" << endl; if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): нет связи с БД" << endl;
} }
else else
init_dbserver(); init_dbserver();
...@@ -460,7 +475,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm ) ...@@ -460,7 +475,8 @@ void DBServer_MySQL::timerInfo( UniSetTypes::TimerMessage* tm )
break; break;
default: default:
unideb[Debug::WARN] << myname << "(timerInfo): неизвестный таймер tid=" << tm->id << endl; if( unideb.debugging(Debug::WARN) )
unideb[Debug::WARN] << myname << "(timerInfo): неизвестный таймер tid=" << tm->id << endl;
break; break;
} }
} }
......
...@@ -138,6 +138,8 @@ class DBServer_MySQL: ...@@ -138,6 +138,8 @@ class DBServer_MySQL:
DBServer_MySQL(); DBServer_MySQL();
~DBServer_MySQL(); ~DBServer_MySQL();
static const Debug::type DBLogInfoLevel = Debug::LEVEL9;
protected: protected:
typedef std::map<int, std::string> DBTableMap; typedef std::map<int, std::string> DBTableMap;
......
...@@ -6,9 +6,9 @@ UIO_VER=@LIBVER@ ...@@ -6,9 +6,9 @@ UIO_VER=@LIBVER@
lib_LTLIBRARIES = libUniSetIOControl.la lib_LTLIBRARIES = libUniSetIOControl.la
libUniSetIOControl_la_LDFLAGS = -version-info $(UIO_VER) libUniSetIOControl_la_LDFLAGS = -version-info $(UIO_VER)
libUniSetIOControl_la_LIBADD = $(COMEDI_LIBS) $(SIGC_LIBS) \ libUniSetIOControl_la_LIBADD = $(COMEDI_LIBS) $(SIGC_LIBS) \
$(top_builddir)/extensions/lib/libUniSetExtensions.la \ $(top_builddir)/extensions/lib/libUniSetExtensions.la \
$(top_builddir)/lib/libUniSet.la \ $(top_builddir)/lib/libUniSet.la \
$(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la $(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la
libUniSetIOControl_la_CXXFLAGS = $(COMEDI_CFLAGS) $(SIGC_CFLAGS) \ libUniSetIOControl_la_CXXFLAGS = $(COMEDI_CFLAGS) $(SIGC_CFLAGS) \
-I$(top_builddir)/extensions/include \ -I$(top_builddir)/extensions/include \
...@@ -16,7 +16,9 @@ libUniSetIOControl_la_CXXFLAGS = $(COMEDI_CFLAGS) $(SIGC_CFLAGS) \ ...@@ -16,7 +16,9 @@ libUniSetIOControl_la_CXXFLAGS = $(COMEDI_CFLAGS) $(SIGC_CFLAGS) \
libUniSetIOControl_la_SOURCES = ComediInterface.cc IOControl.cc libUniSetIOControl_la_SOURCES = ComediInterface.cc IOControl.cc
@PACKAGE@_iocontrol_LDADD = libUniSetIOControl.la $(COMEDI_LIBS) @PACKAGE@_iocontrol_LDADD = libUniSetIOControl.la \
$(top_builddir)/lib/libUniSet.la \
$(top_builddir)/extensions/lib/libUniSetExtensions.la $(COMEDI_LIBS)
@PACKAGE@_iocontrol_CXXFLAGS = $(COMEDI_CFLAGS) $(SIGC_CFLAGS) \ @PACKAGE@_iocontrol_CXXFLAGS = $(COMEDI_CFLAGS) $(SIGC_CFLAGS) \
-I$(top_builddir)/extensions/include \ -I$(top_builddir)/extensions/include \
-I$(top_builddir)/extensions/SharedMemory -I$(top_builddir)/extensions/SharedMemory
......
...@@ -12,7 +12,8 @@ libUniSetSharedMemory_la_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/ ...@@ -12,7 +12,8 @@ libUniSetSharedMemory_la_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/
libUniSetSharedMemory_la_SOURCES = SharedMemory.cc libUniSetSharedMemory_la_SOURCES = SharedMemory.cc
@PACKAGE@_smemory_LDADD = libUniSetSharedMemory.la @PACKAGE@_smemory_LDADD = libUniSetSharedMemory.la $(top_builddir)/lib/libUniSet.la \
$(top_builddir)/extensions/lib/libUniSetExtensions.la
@PACKAGE@_smemory_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/include @PACKAGE@_smemory_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/include
@PACKAGE@_smemory_SOURCES = smemory.cc @PACKAGE@_smemory_SOURCES = smemory.cc
......
...@@ -5,7 +5,7 @@ UNET_VER=@LIBVER@ ...@@ -5,7 +5,7 @@ UNET_VER=@LIBVER@
lib_LTLIBRARIES = libUniSetNetwork.la lib_LTLIBRARIES = libUniSetNetwork.la
libUniSetNetwork_la_LDFLAGS = -version-info $(UNET_VER) libUniSetNetwork_la_LDFLAGS = -version-info $(UNET_VER)
libUniSetNetwork_la_LIBADD = $(SIGC_LIBS) $(top_builddir)/lib/libUniSet.la \ libUniSetNetwork_la_LIBADD = $(SIGC_LIBS) $(top_builddir)/lib/libUniSet.la \
$(top_builddir)/extensions/lib/libUniSetExtensions.la \ $(top_builddir)/extensions/lib/libUniSetExtensions.la \
$(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la $(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la
libUniSetNetwork_la_CPPFLAGS = $(SIGC_CFLAGS) \ libUniSetNetwork_la_CPPFLAGS = $(SIGC_CFLAGS) \
...@@ -13,7 +13,9 @@ libUniSetNetwork_la_CPPFLAGS = $(SIGC_CFLAGS) \ ...@@ -13,7 +13,9 @@ libUniSetNetwork_la_CPPFLAGS = $(SIGC_CFLAGS) \
-I$(top_builddir)/extensions/SharedMemory -I$(top_builddir)/extensions/SharedMemory
libUniSetNetwork_la_SOURCES = UniExchange.cc libUniSetNetwork_la_SOURCES = UniExchange.cc
@PACKAGE@_network_LDADD = libUniSetNetwork.la @PACKAGE@_network_LDADD = libUniSetNetwork.la \
$(top_builddir)/lib/libUniSet.la \
$(top_builddir)/extensions/lib/libUniSetExtensions.la
@PACKAGE@_network_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/include @PACKAGE@_network_CPPFLAGS = $(SIGC_CFLAGS) -I$(top_builddir)/extensions/include
@PACKAGE@_network_SOURCES = uninet.cc @PACKAGE@_network_SOURCES = uninet.cc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment