Skip to content
Snippets Groups Projects
Commit 54d18c1c authored by Michael Davis's avatar Michael Davis
Browse files

[xrd_ssi_pb] Changes all SSI/Protobuf debug logging to log to XRootD logfile

parent 5350e2c8
Branches
Tags
No related merge requests found
Pipeline #32469 failed
......@@ -301,9 +301,7 @@ int CtaAdminCmd::GetRequestTimeout() const
// Use default if XRD_REQUESTTIMEOUT is not a valid positive integer
if(request_timeout <= 0) request_timeout = DefaultRequestTimeout;
#ifdef XRDSSI_DEBUG
std::cerr << "[DEBUG] CtaAdminCmd::GetRequestTimeout(): Request timeout = " << request_timeout << "s" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "GetRequestTimeout(): Request timeout = ", request_timeout, 's');
return request_timeout;
}
......
......@@ -65,6 +65,8 @@ private:
std::string m_execname; //!< Executable name of this program
cta::xrd::Request m_request; //!< Protocol Buffer for the command and parameters
static constexpr const char* const LOG_SUFFIX = "CtaAdminCmd"; //!< Identifier for log messages
};
}} // namespace cta::admin
......
......@@ -117,9 +117,7 @@ void base64Decode(cta::eos::Notification &notification, const std::string &argva
else if(key == "mode") notification.mutable_file()->set_mode(stoi(val));
else if(key == "file") notification.mutable_file()->set_lpath(val);
else {
#ifdef XRDSSI_DEBUG
cout << "No match in protobuf for fmd:" << key << "=" << val << endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::ERROR, "base64Decode", "No match in protobuf for fmd:", key, '=', val);
}
}
......@@ -163,9 +161,7 @@ void base64Decode(cta::eos::Notification &notification, const std::string &argva
notification.mutable_directory()->mutable_xattr()->insert(google::protobuf::MapPair<string,string>(xattrn, val));
}
else {
#ifdef XRDSSI_DEBUG
cout << "No match in protobuf for dmd:" << key << "=" << val << endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::ERROR, "base64Decode", "No match in protobuf for dmd:", key, '=', val);
}
}
}
......
......@@ -41,8 +41,6 @@ set_property (TARGET XrdSsiCta APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
if (OCCI_SUPPORT)
set_property (TARGET XrdSsiCta APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH})
endif (OCCI_SUPPORT)
# Get some extra debug messages on stderr
#target_compile_definitions(XrdSsiCta PRIVATE XRDSSI_DEBUG)
install(TARGETS XrdSsiCta DESTINATION usr/${CMAKE_INSTALL_LIBDIR})
install(FILES cta-frontend-xrootd.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta)
......
......@@ -35,15 +35,11 @@ public:
XrdSsiStream(XrdSsiStream::isActive),
m_archiveFileItor(std::move(archiveFileItor))
{
#ifdef XRDSSI_DEBUG
std::cerr << "[DEBUG] ArchiveFileLsStream() constructor" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "ArchiveFileLsStream() constructor");
}
virtual ~ArchiveFileLsStream() {
#ifdef XRDSSI_DEBUG
std::cerr << "[DEBUG] ArchiveFileLsStream() destructor" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "~ArchiveFileLsStream() destructor");
}
/*!
......@@ -66,9 +62,7 @@ public:
* last = false: A fatal error occurred, eRef has the reason.
*/
virtual Buffer *GetBuff(XrdSsiErrInfo &eInfo, int &dlen, bool &last) {
#ifdef XRDSSI_DEBUG
std::cerr << "[DEBUG] ArchiveFileLsStream::GetBuff(): XrdSsi buffer fill request (" << dlen << " bytes)" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "GetBuff(): XrdSsi buffer fill request (", dlen, " bytes)");
XrdSsiPb::OStreamBuffer<cta::xrd::Data> *streambuf;
......@@ -120,9 +114,7 @@ public:
}
}
dlen = streambuf->Size();
#ifdef XRDSSI_DEBUG
std::cerr << "[DEBUG] ArchiveFileLsStream::GetBuff(): Returning buffer with " << dlen << " bytes of data." << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "GetBuff(): Returning buffer with ", dlen, " bytes of data.");
} catch(cta::exception::Exception &ex) {
throw std::runtime_error(ex.getMessage().str());
} catch(std::exception &ex) {
......@@ -141,6 +133,8 @@ public:
private:
catalogue::ArchiveFileItor m_archiveFileItor;
static constexpr const char* const LOG_SUFFIX = "ArchiveFileLsStream"; //!< Identifier for log messages
};
}} // namespace cta::xrd
......
......@@ -19,9 +19,7 @@
#include "common/dataStructures/ArchiveRequest.hpp"
#include "common/exception/Exception.hpp"
#ifdef XRDSSI_DEBUG
#include "XrdSsiPbDebug.hpp"
#endif
#include "XrdSsiPbLog.hpp"
#include "XrdSsiPbException.hpp"
#include "XrdSsiPbRequestProc.hpp"
......@@ -60,11 +58,8 @@ void RequestProc<cta::xrd::Request, cta::xrd::Response, cta::xrd::Alert>::Execut
throw cta::exception::Exception("XRootD Service is not a CTA Service");
}
#ifdef XRDSSI_DEBUG
// Output message in Json format
OutputJsonString(std::cerr, &m_request);
#endif
Log::DumpProtobuf(Log::PROTOBUF, &m_request);
cta::xrd::RequestMessage request_msg(*(m_resource.client), cta_service_ptr);
request_msg.process(m_request, m_metadata, m_response_stream_ptr);
......@@ -75,16 +70,6 @@ void RequestProc<cta::xrd::Request, cta::xrd::Response, cta::xrd::Alert>::Execut
m_metadata.set_type(cta::xrd::Response::RSP_ERR_PROTOBUF);
m_metadata.set_message_txt(ex.what());
} catch(std::exception &ex) {
#ifdef XRDSSI_DEBUG
// Serialize and send a log message
cta::xrd::Alert alert_msg;
alert_msg.set_audience(cta::xrd::Alert::LOG);
alert_msg.set_message_txt("Something bad happened");
Alert(alert_msg);
#endif
m_metadata.set_type(cta::xrd::Response::RSP_ERR_CTA);
m_metadata.set_message_txt(ex.what());
}
......
......@@ -16,10 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef XRDSSI_DEBUG
#include <iostream>
#endif
#include "XrdSsiPbAlert.hpp"
#include "XrdSsiPbService.hpp"
#include "cta_frontend.pb.h"
......@@ -58,9 +54,7 @@ bool XrdSsiCtaServiceProvider::Init(XrdSsiLogger *logP, XrdSsiCluster *clsP, con
{
using namespace cta;
#ifdef XRDSSI_DEBUG
std::cout << "[DEBUG] Called Init(" << cfgFn << "," << parms << ")" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::INFO, LOG_SUFFIX, "Called Init(", cfgFn, ',', parms, ')');
// Instantiate the logging system
......@@ -129,9 +123,7 @@ bool XrdSsiCtaServiceProvider::Init(XrdSsiLogger *logP, XrdSsiCluster *clsP, con
XrdSsiService* XrdSsiCtaServiceProvider::GetService(XrdSsiErrInfo &eInfo, const std::string &contact, int oHold)
{
#ifdef XRDSSI_DEBUG
std::cout << "[DEBUG] Called GetService(" << contact << "," << oHold << ")" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::INFO, LOG_SUFFIX, "Called GetService(", contact, ',', oHold, ')');
XrdSsiService *ptr = new XrdSsiPb::Service<cta::xrd::Request, cta::xrd::Response, cta::xrd::Alert>;
......@@ -161,11 +153,8 @@ XrdSsiProvider::rStat XrdSsiCtaServiceProvider::QueryResource(const char *rName,
XrdSsiProvider::rStat resourcePresence = (strcmp(rName, "/ctafrontend") == 0) ?
XrdSsiProvider::isPresent : XrdSsiProvider::notPresent;
#ifdef XRDSSI_DEBUG
std::cout << "[DEBUG] XrdSsiCtaServiceProvider::QueryResource(" << rName << "): "
<< ((resourcePresence == XrdSsiProvider::isPresent) ? "isPresent" : "notPresent")
<< std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::INFO, LOG_SUFFIX, "QueryResource(", rName, "): ",
((resourcePresence == XrdSsiProvider::isPresent) ? "isPresent" : "notPresent"));
return resourcePresence;
}
......
......@@ -18,10 +18,6 @@
#pragma once
#ifdef XRDSSI_DEBUG
#include <iostream>
#endif
#include <XrdSsi/XrdSsiProvider.hh>
#include "common/Configuration.hpp"
......@@ -50,15 +46,11 @@ class XrdSsiCtaServiceProvider : public XrdSsiProvider
public:
XrdSsiCtaServiceProvider() : m_ctaConf("/etc/cta/cta-frontend.conf")
{
#ifdef XRDSSI_DEBUG
std::cout << "[DEBUG] XrdSsiCtaServiceProvider() constructor" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "XrdSsiCtaServiceProvider() constructor");
}
virtual ~XrdSsiCtaServiceProvider() {
#ifdef XRDSSI_DEBUG
std::cout << "[DEBUG] ~XrdSsiCtaServiceProvider() destructor" << std::endl;
#endif
XrdSsiPb::Log::Msg(XrdSsiPb::Log::DEBUG, LOG_SUFFIX, "~XrdSsiCtaServiceProvider() destructor");
}
/*!
......@@ -125,5 +117,7 @@ private:
std::unique_ptr<cta::Scheduler> m_scheduler; //!< The scheduler
std::unique_ptr<cta::log::Logger> m_log; //!< The logger
UniquePtrAgentHeartbeatThread m_agentHeartbeat; //!< Agent heartbeat thread
static constexpr const char* const LOG_SUFFIX = "XrdSsiCtaServiceProvider"; //!< Identifier for log messages
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment