mariadb/storage/ndb/include/debugger/EventLogger.hpp
unknown 2ff26b97f2 ndb-wl2325.patch
storage/ndb/include/debugger/EventLogger.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/GlobalSignalNumbers.h:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/NodeInfo.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/AlterTab.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/CreateEvnt.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/CreateTab.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/DropTab.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/EventReport.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/kernel/signaldata/SumaImpl.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/mgmapi/mgmapi.h:
  Import patch ndb-wl2325.patch
storage/ndb/include/mgmapi/mgmapi_config_parameters.h:
  Import patch ndb-wl2325.patch
storage/ndb/include/mgmapi/ndb_logevent.h:
  Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/Ndb.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/NdbDictionary.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/NdbError.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/NdbEventOperation.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/ndb_cluster_connection.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/include/ndbapi/ndberror.h:
  Import patch ndb-wl2325.patch
storage/ndb/ndbapi-examples/Makefile:
  Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/EventLogger.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/Makefile.am:
  Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/signaldata/SignalNames.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/common/debugger/signaldata/SumaImpl.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/SimBlockList.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrSysTable.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/suma/Suma.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/suma/Suma.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/suma/SumaInit.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/trix/Trix.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/blocks/trix/Trix.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/vm/Configuration.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/kernel/vm/SimulatedBlock.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/mgmapi/mgmapi.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/mgmapi/ndb_logevent.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/MgmtSrvr.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/Services.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/mgmsrv/Services.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ClusterMgr.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ClusterMgr.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndb.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbDictionary.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbEventOperation.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbImpl.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/NdbWaiter.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndberr.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndbif.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/Ndbinit.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ObjectMap.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/TransporterFacade.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/TransporterFacade.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/src/ndbapi/ndberror.c:
  Import patch ndb-wl2325.patch
storage/ndb/test/include/HugoOperations.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/include/HugoTransactions.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/include/NDBT_Table.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/include/NDBT_Test.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/Makefile.am:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/Bank.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/Bank.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankCreator.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankMakeGL.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankSumAccounts.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankTimer.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankTransactionMaker.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bank/testBank.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bench/asyncGenerator.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/bench/ndb_schema.hpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/test_event.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/ndbapi/test_event_multi_table.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/run-test/Makefile.am:
  Import patch ndb-wl2325.patch
storage/ndb/test/run-test/daily-devel-tests.txt:
  Import patch ndb-wl2325.patch
storage/ndb/test/src/HugoOperations.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/src/HugoTransactions.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/src/NDBT_ResultRow.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/src/NDBT_Tables.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/src/NDBT_Test.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/src/UtilTransactions.cpp:
  Import patch ndb-wl2325.patch
storage/ndb/test/tools/Makefile.am:
  Import patch ndb-wl2325.patch
2005-09-15 11:33:50 +02:00

179 lines
4.9 KiB
C++

/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef EVENTLOGGER_H
#define EVENTLOGGER_H
#include <logger/Logger.hpp>
#include <logger/FileLogHandler.hpp>
#include <kernel/kernel_types.h>
#include <kernel/LogLevel.hpp>
#include <kernel/signaldata/EventReport.hpp>
class EventLoggerBase {
public:
virtual ~EventLoggerBase();
/**
* LogLevel settings
*/
LogLevel m_logLevel;
/**
* This matrix defines which event should be printed when
*
* threshold - is in range [0-15]
* severity - DEBUG to ALERT (Type of log message)
*/
typedef void (* EventTextFunction)(char *,size_t,const Uint32*);
struct EventRepLogLevelMatrix {
Ndb_logevent_type eventType;
LogLevel::EventCategory eventCategory;
Uint32 threshold;
Logger::LoggerLevel severity;
EventTextFunction textF;
};
static const EventRepLogLevelMatrix matrix[];
static const Uint32 matrixSize;
static int event_lookup(int eventType,
LogLevel::EventCategory &cat,
Uint32 &threshold,
Logger::LoggerLevel &severity,
EventTextFunction &textF);
};
/**
* The EventLogger is primarily used for logging NDB events
* in the Management Server. It inherits all logging functionality of Logger.
*
* HOW TO USE
*
* 1) Create an EventLogger
*
* EventLogger myEventLogger = new EventLogger();
*
* 2) Log NDB events and other log messages.
*
* myEventLogger->info("Changing log levels.");
*
* EventReport* report = (EventReport*)&theSignalData[0];
* myEventLogger->log(eventReport->getEventType(), theSignalData, aNodeId);
*
*
* The following NDB event categories and log levels are enabled as default:
*
* EVENT-CATEGORY LOG-LEVEL
*
* Startup 4
* Shutdown 1
* Statistic 2
* Checkpoint 5
* NodeRestart 8
* Connection 2
* Error 15
* Info 10
*
* @see Logger
* @version #@ $Id: EventLogger.hpp,v 1.3 2003/09/01 10:15:52 innpeno Exp $
*/
class EventLogger : public EventLoggerBase, public Logger
{
public:
/**
* Default constructor. Enables default log levels and
* sets the log category to 'EventLogger'.
*/
EventLogger();
/**
* Destructor.
*/
virtual ~EventLogger();
/**
* Opens/creates the eventlog with the specified filename.
*
* @param aFileName the eventlog filename.
* @param maxNoFiles the maximum no of archived eventlog files.
* @param maxFileSize the maximum eventlog file size.
* @param maxLogEntries the maximum number of log entries before
* checking time to archive.
* @return true if successful.
*/
bool open(const char* logFileName,
int maxNoFiles = FileLogHandler::MAX_NO_FILES,
long int maxFileSize = FileLogHandler::MAX_FILE_SIZE,
unsigned int maxLogEntries = FileLogHandler::MAX_LOG_ENTRIES);
/**
* Closes the eventlog.
*/
void close();
/**
* Logs the NDB event.
*
* @param eventType the type of event.
* @param theData the event data.
* @param nodeId the node id of event origin.
*/
virtual void log(int, const Uint32*, NodeId = 0,const class LogLevel * = 0);
/**
* Returns the event text for the specified event report type.
*
* @param textF print function for the event
* @param theData the event data.
* @param nodeId a node id.
* @return the event report text.
*/
static const char* getText(char * dst, size_t dst_len,
EventTextFunction textF,
const Uint32* theData, NodeId nodeId = 0);
/**
* Returns the log level that is used to filter an event. The event will not
* be logged unless its event category's log level is <= levelFilter.
*
* @return the log level filter that is used for all event categories.
*/
int getFilterLevel() const;
/**
* Sets log level filter. The event will be logged if
* the event category's log level is <= 'filterLevel'.
*
* @param level the log level to filter.
*/
void setFilterLevel(int filterLevel);
private:
/** Prohibit */
EventLogger(const EventLogger&);
EventLogger operator = (const EventLogger&);
bool operator == (const EventLogger&);
Uint32 m_filterLevel;
STATIC_CONST(MAX_TEXT_LENGTH = 256);
char m_text[MAX_TEXT_LENGTH];
};
#endif