***********************
** FILE NAME : gcm_input.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.10 $
+** VERSION NUMBER : $Revision: 1.11 $
**
** DESCRIPTION : Application to store client messages into the database
** The client message contains a log file from one of the
/*****************************
$Log: gcm_input.cpp,v $
- Revision 1.10 2003-09-03 06:58:31 arjen
+ Revision 1.11 2003-10-27 13:00:15 arjen
+ Catch exceptions from the database library
+
+ Revision 1.10 2003/09/03 06:58:31 arjen
Changed version string to 0.0.8
Revision 1.9 2003/09/01 06:59:26 arjen
*****************************/
-static const char *RCSID = "$Id: gcm_input.cpp,v 1.10 2003-09-03 06:58:31 arjen Exp $";
+static const char *RCSID = "$Id: gcm_input.cpp,v 1.11 2003-10-27 13:00:15 arjen Exp $";
#include <fstream>
String log_method = cfg.find_parameter("logging", "method");
String log_destination = cfg.find_parameter("logging", "destination");
- int level = cfg.find_parameter("gcm_input", "level");
+ int level = cfg.find_parameter("logging", "level");
if (log_method == "file" && log_destination != "")
{
- std::cerr << "Logging to " << log_destination << ".\n";
#if __GNUC__ == 2
logfile.open(log_destination, _IO_APPEND); // for gcc 2
#else
else
{
log = &logfile;
- verbose = verbose || level > 0;
}
}
+ verbose = verbose || level > 0;
if (verbose)
{
if (msg.classify(hostname, arrival, service) > 0.9)
{
- msg.enter();
+ try
+ {
+ msg.enter();
+ }
+ catch (exception &e)
+ {
+ *log << "Caught an exception: " << e.what() << "\n";
+ }
}
return 0;
}