1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-17 01:02:23 +03:00

add SMLogging.

This commit is contained in:
Ben Thompson
2019-03-04 11:41:25 -06:00
parent 2619aa8983
commit b3f8a5ed47
18 changed files with 159 additions and 57 deletions

3
CMakeLists.txt Normal file → Executable file
View File

@@ -25,9 +25,10 @@ set(storagemanager_SRCS
src/S3Storage.cpp
src/LocalStorage.cpp
src/Cache.cpp
src/SMLogging.cpp
)
option(TRACE "Enable some tracing output" OFF)
option(TRACE "Enable some tracing output" ON)
if (TRACE)
add_definitions(-DSM_TRACE)
endif()

View File

@@ -1,6 +1,7 @@
#include "AppendTask.h"
#include "messageFormat.h"
#include "SMLogging.h"
#include <errno.h>
using namespace std;
@@ -27,6 +28,7 @@ AppendTask::~AppendTask()
bool AppendTask::run()
{
SMLogging* logger = SMLogging::get();
bool success;
uint8_t cmdbuf[1024] = {0};
int err;
@@ -44,7 +46,7 @@ bool AppendTask::run()
check_error("AppendTask read", false);
#ifdef SM_TRACE
syslog(LOG_DEBUG, "append %d bytes to %s.",cmd->count,cmd->filename);
logger->log(LOG_DEBUG,"append %d bytes to %s.",cmd->count,cmd->filename);
#endif
size_t readCount = 0, writeCount = 0;

View File

@@ -3,8 +3,8 @@
#include "Config.h"
#include "S3Storage.h"
#include "LocalStorage.h"
#include "SMLogging.h"
#include <boost/thread/mutex.hpp>
#include <syslog.h>
#include <string>
#include <ctype.h>
@@ -29,6 +29,7 @@ namespace storagemanager
{
CloudStorage * CloudStorage::get()
{
SMLogging* logger = SMLogging::get();
if (inst)
return inst;
@@ -42,7 +43,7 @@ CloudStorage * CloudStorage::get()
else if (type == "local")
inst = new LocalStorage();
else {
syslog(LOG_CRIT, "CloudStorage: got unknown service provider: %s", type.c_str());
logger->log(LOG_CRIT,"CloudStorage: got unknown service provider: %s", type.c_str());
return NULL;
}

View File

@@ -1,7 +1,7 @@
#include "CopyTask.h"
#include <errno.h>
#include "syslog.h"
#include "SMLogging.h"
#include "messageFormat.h"
using namespace std;
@@ -27,6 +27,8 @@ CopyTask::~CopyTask()
bool CopyTask::run()
{
bool success;
SMLogging* logger = SMLogging::get();
uint8_t buf[2048] = {0};
if (getLength() > 2047)
@@ -42,7 +44,7 @@ bool CopyTask::run()
f_name *filename2 = (f_name *) &buf[sizeof(copy_cmd) + cmd->file1.flen];
#ifdef SM_TRACE
syslog(LOG_DEBUG, "copy %s to %s.",filename1,filename2);
logger->log(LOG_DEBUG,"copy %s to %s.",filename1.c_str(),filename2->filename);
#endif
int err = ioc->copyFile(filename1.c_str(), filename2->filename);

View File

@@ -1,9 +1,8 @@
#include "IOCoordinator.h"
#include "SMLogging.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <syslog.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
@@ -191,6 +190,7 @@ int IOCoordinator::unlink(const char *path)
int IOCoordinator::copyFile(const char *filename1, const char *filename2)
{
SMLogging* logger = SMLogging::get();
int err = 0, l_errno;
try {
boost::filesystem::copy_file(filename1, filename2);
@@ -200,7 +200,7 @@ int IOCoordinator::copyFile(const char *filename1, const char *filename2)
l_errno = e.code().value(); // why not.
// eh, not going to translate all of boost's errors into our errors for this.
// log the error
syslog(LOG_ERR, "IOCoordinator::copy(): got %s",e.what());
logger->log(LOG_ERR,"IOCoordinator::copy(): got %s",e.what());
}
catch (...) {
err = -1;

View File

@@ -1,5 +1,6 @@
#include "ListDirectoryTask.h"
#include "SMLogging.h"
#include "messageFormat.h"
#include <errno.h>
#include <string.h>
@@ -57,6 +58,7 @@ bool ListDirectoryTask::writeString(uint8_t *buf, int *offset, int size, const s
bool ListDirectoryTask::run()
{
SMLogging* logger = SMLogging::get();
bool success;
uint8_t buf[1024] = {0};
int err;
@@ -71,7 +73,7 @@ bool ListDirectoryTask::run()
listdir_cmd *cmd = (listdir_cmd *) buf;
#ifdef SM_TRACE
syslog(LOG_DEBUG, "list_directory %s.",cmd->path);
logger->log(LOG_DEBUG,"list_directory %s.",cmd->path);
#endif
vector<string> listing;

View File

@@ -2,6 +2,7 @@
#include "OpenTask.h"
#include "messageFormat.h"
#include "SMLogging.h"
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
@@ -26,6 +27,7 @@ bool OpenTask::run()
call IOManager to do the work
return the result
*/
SMLogging* logger = SMLogging::get();
bool success;
uint8_t buf[1024] = {0};
@@ -45,7 +47,7 @@ bool OpenTask::run()
open_cmd *cmd = (open_cmd *) buf;
#ifdef SM_TRACE
syslog(LOG_DEBUG, "open filename %s mode %o.",cmd->filename,cmd->openmode);
logger->log(LOG_DEBUG,"open filename %s mode %o.",cmd->filename,cmd->openmode);
#endif
sm_response *resp = (sm_response *) buf;
int err = ioc->open(cmd->filename, cmd->openmode, (struct stat *) &resp->payload);

View File

@@ -1,10 +1,10 @@
#include "PosixTask.h"
#include "messageFormat.h"
#include "SMLogging.h"
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <syslog.h>
#include <string.h>
#define min(x, y) (x < y ? x : y)
@@ -34,6 +34,7 @@ PosixTask::~PosixTask()
void PosixTask::handleError(const char *name, int errCode)
{
SMLogging* logger = SMLogging::get();
char buf[sizeof(sm_response) + 4];
// send an error response if possible
@@ -43,7 +44,7 @@ void PosixTask::handleError(const char *name, int errCode)
write(*resp, 4);
// TODO: construct and log a message
syslog(LOG_ERR, "%s caught an error: %s.",name,strerror_r(errCode, buf, 80));
logger->log(LOG_ERR,"%s caught an error: %s.",name,strerror_r(errCode, buf, 80));
}
uint PosixTask::getRemainingLength()
@@ -178,6 +179,8 @@ bool PosixTask::write(const vector<uint8_t> &buf)
void PosixTask::consumeMsg()
{
SMLogging* logger = SMLogging::get();
uint8_t buf[1024];
int err;
@@ -187,7 +190,7 @@ void PosixTask::consumeMsg()
while (remainingLengthInStream > 0)
{
syslog(LOG_ERR, "ERROR: eating data.");
logger->log(LOG_ERR,"ERROR: eating data.");
err = ::recv(sock, buf, min(remainingLengthInStream, 1024), 0);
if (err <= 0) {
remainingLengthInStream = 0;

View File

@@ -4,7 +4,6 @@
#include <iostream>
#include "messageFormat.h"
#include <sys/socket.h>
#include <syslog.h>
#include <boost/scoped_ptr.hpp>
#include "AppendTask.h"
@@ -18,6 +17,7 @@
#include "UnlinkTask.h"
#include "WriteTask.h"
#include "SessionManager.h"
#include "SMLogging.h"
using namespace std;
@@ -37,10 +37,11 @@ ProcessTask::~ProcessTask()
void ProcessTask::handleError(int saved_errno)
{
SMLogging* logger = SMLogging::get();
SessionManager::get()->socketError(sock);
returnedSock = true;
char buf[80];
syslog(LOG_ERR, "ProcessTask: got an error during a socket read: %s.",strerror_r(saved_errno, buf, 80));
logger->log(LOG_ERR,"ProcessTask: got an error during a socket read: %s.",strerror_r(saved_errno, buf, 80));
}
void ProcessTask::operator()()

View File

@@ -1,6 +1,7 @@
#include "ReadTask.h"
#include "messageFormat.h"
#include "SMLogging.h"
#include <errno.h>
using namespace std;
@@ -27,6 +28,7 @@ ReadTask::~ReadTask()
bool ReadTask::run()
{
SMLogging* logger = SMLogging::get();
uint8_t buf[1024] = {0};
// get the parameters
@@ -41,7 +43,7 @@ bool ReadTask::run()
read_cmd *cmd = (read_cmd *) buf;
#ifdef SM_TRACE
syslog(LOG_DEBUG, "read %s count %i offset %i.",cmd->filename,cmd->count,cmd->offset);
logger->log(LOG_DEBUG,"read %s count %i offset %i.",cmd->filename,cmd->count,cmd->offset);
#endif
// read from IOC, write to the socket

51
src/SMLogging.cpp Normal file
View File

@@ -0,0 +1,51 @@
#include <stdarg.h>
#include <unistd.h>
#include "SMLogging.h"
using namespace std;
namespace
{
storagemanager::SMLogging *smLog = NULL;
boost::mutex m;
};
namespace storagemanager
{
SMLogging::SMLogging()
{
//TODO: make this configurable
setlogmask (LOG_UPTO (LOG_DEBUG));
openlog ("StorageManager", LOG_PID | LOG_NDELAY, LOG_LOCAL2);
}
SMLogging::~SMLogging()
{
syslog(LOG_INFO, "CloseLog");
closelog();
}
SMLogging * SMLogging::get()
{
if (smLog)
return smLog;
boost::mutex::scoped_lock s(m);
if (smLog)
return smLog;
smLog = new SMLogging();
return smLog;
}
void SMLogging::log(int priority,const char *format, ...)
{
va_list args;
va_start(args, format);
vsyslog(priority, format, args);
va_end(args);
}
}

29
src/SMLogging.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef SM_LOGGING_H_
#define SM_LOGGING_H_
#include <syslog.h>
#include <boost/thread.hpp>
namespace storagemanager
{
class SMLogging
{
public:
static SMLogging *get();
~SMLogging();
void log(int priority, const char *format, ...);
private:
SMLogging();
//SMConfig& config;
};
}
#endif

View File

@@ -12,7 +12,6 @@
#include <string>
#include <assert.h>
#include <iostream>
#include <syslog.h>
using namespace std;
#include <exception>
@@ -20,6 +19,7 @@ using namespace std;
#include "messageFormat.h"
#include "SessionManager.h"
#include "ClientRequestProcessor.h"
#include "SMLogging.h"
#include <boost/thread.hpp>
namespace
@@ -53,6 +53,7 @@ SessionManager * SessionManager::get()
int SessionManager::start()
{
SMLogging* logger = SMLogging::get();
int rc,listenSockfd,incomingSockfd,on = 1;
struct sockaddr_un addr;
int nfds;
@@ -61,25 +62,25 @@ int SessionManager::start()
int current_size = 0;
bool running = true;
syslog(LOG_INFO, "SessionManager starting...");
logger->log(LOG_INFO,"SessionManager starting...");
if (pipe(socketCtrl)==-1)
{
syslog(LOG_CRIT, "Pipe Failed: %s", strerror(errno));
logger->log(LOG_CRIT,"Pipe Failed: %s", strerror(errno));
return 1;
}
listenSockfd = ::socket(AF_UNIX, SOCK_STREAM, 0);
if (listenSockfd < 0)
{
syslog(LOG_CRIT, "socket() failed: %s", strerror(errno));
logger->log(LOG_CRIT,"socket() failed: %s", strerror(errno));
return -1;
}
rc = ::setsockopt(listenSockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
if (rc < 0)
{
syslog(LOG_CRIT, "setsockopt() failed: %s", strerror(errno));
logger->log(LOG_CRIT,"setsockopt() failed: %s", strerror(errno));
close(listenSockfd);
return -1;
}
@@ -87,7 +88,7 @@ int SessionManager::start()
rc = ::ioctl(listenSockfd, FIONBIO, (char *)&on);
if (rc < 0)
{
syslog(LOG_CRIT, "ioctl() failed: %s", strerror(errno));
logger->log(LOG_CRIT,"ioctl() failed: %s", strerror(errno));
close(listenSockfd);
return -1;
}
@@ -98,7 +99,7 @@ int SessionManager::start()
rc = ::bind(listenSockfd,(struct sockaddr *)&addr, sizeof(addr));
if (rc < 0)
{
syslog(LOG_CRIT, "bind() failed: %s", strerror(errno));
logger->log(LOG_CRIT,"bind() failed: %s", strerror(errno));
close(listenSockfd);
return -1;
}
@@ -106,7 +107,7 @@ int SessionManager::start()
rc = ::listen(listenSockfd, 32);
if (rc < 0)
{
syslog(LOG_CRIT, "listen() failed: %s", strerror(errno));
logger->log(LOG_CRIT,"listen() failed: %s", strerror(errno));
close(listenSockfd);
return -1;
}
@@ -118,18 +119,18 @@ int SessionManager::start()
fds[1].events = POLLIN;
nfds = 2;
syslog(LOG_INFO, "SessionManager waiting for sockets.");
logger->log(LOG_INFO,"SessionManager waiting for sockets.");
while (running)
{
try
{
//if (current_size != nfds)
//syslog(LOG_DEBUG, "polling %i fds %i", nfds,fds);
//logger->log(LOG_DEBUG,"polling %i fds %i", nfds,fds);
//cout << "polling " << nfds << " fds" << endl;
rc = ::poll(fds, nfds, pollTimeout);
if (rc < 0)
{
syslog(LOG_CRIT, "poll() failed: %s", strerror(errno));
logger->log(LOG_CRIT,"poll() failed: %s", strerror(errno));
break;
}
current_size = nfds;
@@ -139,16 +140,16 @@ int SessionManager::start()
if(fds[socketIncr].revents == 0)
continue;
//if (socketIncr >= 2)
//syslog(LOG_DEBUG, "got event on fd %i index is %i", fds[socketIncr].fd,socketIncr);
//logger->log(LOG_DEBUG,"got event on fd %i index is %i", fds[socketIncr].fd,socketIncr);
if(fds[socketIncr].revents != POLLIN)
{
//syslog(LOG_DEBUG, "Error! revents = %d", fds[socketIncr].revents,);
//logger->log(LOG_DEBUG,"Error! revents = %d", fds[socketIncr].revents,);
close(fds[socketIncr].fd);
fds[socketIncr].fd = -1;
}
if (fds[socketIncr].fd == listenSockfd)
{
//syslog(LOG_DEBUG, "Listening socket is readable");
//logger->log(LOG_DEBUG,"Listening socket is readable");
incomingSockfd = 0;
while (incomingSockfd != -1)
{
@@ -160,12 +161,12 @@ int SessionManager::start()
{
if (errno != EWOULDBLOCK)
{
syslog(LOG_CRIT, "accept() failed: %s", strerror(errno));
logger->log(LOG_CRIT,"accept() failed: %s", strerror(errno));
running = false;
}
break;
}
//syslog(LOG_DEBUG, "New incoming connection - %d",incomingSockfd);
//logger->log(LOG_DEBUG,"New incoming connection - %d",incomingSockfd);
fds[nfds].fd = incomingSockfd;
fds[nfds].events = POLLIN;
nfds++;
@@ -173,7 +174,7 @@ int SessionManager::start()
}
else if (fds[socketIncr].fd == socketCtrl[0])
{
//syslog(LOG_DEBUG, "SocketControl is readable");
//logger->log(LOG_DEBUG,"SocketControl is readable");
uint8_t ctrlCode;
int len,socket;
@@ -194,7 +195,7 @@ int SessionManager::start()
{
if(fds[i].fd == socket)
{
//syslog(LOG_DEBUG, "returned socket %i at index %i", fds[i].fd,i);
//logger->log(LOG_DEBUG,"returned socket %i at index %i", fds[i].fd,i);
fds[i].events = POLLIN;
break;
}
@@ -222,7 +223,7 @@ int SessionManager::start()
}
else
{
//syslog(LOG_DEBUG, "socketIncr %d -- Descriptor %d is readable",socketIncr,fds[socketIncr].fd);
//logger->log(LOG_DEBUG,"socketIncr %d -- Descriptor %d is readable",socketIncr,fds[socketIncr].fd);
bool closeConn = false;
char recv_buffer[8192];
uint recvMsgLength = 0;
@@ -233,7 +234,7 @@ int SessionManager::start()
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 100000000; // .1 sec
//syslog(LOG_DEBUG, "reading from fd %i index is %i", fds[socketIncr].fd,socketIncr);
//logger->log(LOG_DEBUG,"reading from fd %i index is %i", fds[socketIncr].fd,socketIncr);
if (sockState.find(fds[socketIncr].fd) != sockState.end())
{
SockState &state = sockState[fds[socketIncr].fd];
@@ -260,7 +261,7 @@ int SessionManager::start()
sockState[fds[socketIncr].fd] = state;
break;
}
//syslog(LOG_DEBUG, "recv got %i bytes", peakLength);
//logger->log(LOG_DEBUG,"recv got %i bytes", peakLength);
endOfData = remainingBytes + peakLength;
if (endOfData < SM_HEADER_LEN)
{
@@ -276,12 +277,12 @@ int SessionManager::start()
{
if (*((uint *) &recv_buffer[i]) == SM_MSG_START)
{
//syslog(LOG_DEBUG, "Received SM_MSG_START");
//logger->log(LOG_DEBUG,"Received SM_MSG_START");
//found it set msgLength and recvMsgStart offset of SM_MSG_START
recvMsgLength = *((uint *) &recv_buffer[i+4]);
//syslog(LOG_DEBUG, "got length = %i", recvMsgLength);
//logger->log(LOG_DEBUG,"got length = %i", recvMsgLength);
recvMsgStart = i + SM_HEADER_LEN;
//syslog(LOG_DEBUG, "recvMsgLength %d recvMsgStart %d endofData %d", recvMsgLength,recvMsgStart,endOfData);
//logger->log(LOG_DEBUG,"recvMsgLength %d recvMsgStart %d endofData %d", recvMsgLength,recvMsgStart,endOfData);
// if >= endOfData then the start of the message data is the beginning of next message
if (recvMsgStart >= endOfData)
recvMsgStart = 0;
@@ -292,7 +293,7 @@ int SessionManager::start()
// didn't find SM_MSG_START in this message consume the data and loop back through on next message
if (recvMsgLength == 0)
{
//syslog(LOG_DEBUG, "No SM_MSG_START");
//logger->log(LOG_DEBUG,"No SM_MSG_START");
len = ::read(fds[socketIncr].fd, &recv_buffer[remainingBytes], peakLength);
assert(len == peakLength);
// we know the msg header isn't in position [0, endOfData - i), so throw that out
@@ -307,7 +308,7 @@ int SessionManager::start()
//remove the junk in front of the message
if (recvMsgStart > 0)
{
//syslog(LOG_DEBUG, "SM_MSG_START data is here");
//logger->log(LOG_DEBUG,"SM_MSG_START data is here");
// how many to consume here...
// recvMsgStart is the position in the buffer
// peakLength is the amount peeked this time
@@ -316,7 +317,7 @@ int SessionManager::start()
}
else
{
//syslog(LOG_DEBUG, "SM_MSG_START data is next message");
//logger->log(LOG_DEBUG,"SM_MSG_START data is next message");
len = ::read(fds[socketIncr].fd, &recv_buffer[remainingBytes], peakLength);
}
//Disable polling on this socket
@@ -327,7 +328,7 @@ int SessionManager::start()
/*
//Doing this to work with cloudio_component_test
len = ::read(fds[socketIncr].fd, out, recvMsgLength);
syslog(LOG_DEBUG, "Read %d bytes.",len);
logger->log(LOG_DEBUG,"Read %d bytes.",len);
//Debug test lets send a reponse back
uint32_t response[4] = { storagemanager::SM_MSG_START, 8, (uint32_t ) -1, EINVAL };
len = ::send(fds[socketIncr].fd, response, 16, 0);
@@ -387,7 +388,8 @@ void SessionManager::returnSocket(int socket)
void SessionManager::socketError(int socket)
{
boost::mutex::scoped_lock s(ctrlMutex);
syslog(LOG_CRIT, " ****** socket error!");
SMLogging* logger = SMLogging::get();
logger->log(LOG_CRIT," ****** socket error!");
int err;
uint8_t ctrlCode = REMOVEFD;
err = ::write(socketCtrl[1], &ctrlCode, 1);

View File

@@ -1,6 +1,7 @@
#include "StatTask.h"
#include "messageFormat.h"
#include "SMLogging.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -29,6 +30,7 @@ StatTask::~StatTask()
bool StatTask::run()
{
SMLogging* logger = SMLogging::get();
bool success;
uint8_t buf[1024] = {0};
@@ -43,7 +45,7 @@ bool StatTask::run()
sm_response *resp = (sm_response *) buf;
#ifdef SM_TRACE
syslog(LOG_DEBUG, "stat %s.",cmd->filename);
logger->log(LOG_DEBUG,"stat %s.",cmd->filename);
#endif
int err = ioc->stat(cmd->filename, (struct stat *) resp->payload);

View File

@@ -2,6 +2,7 @@
#include "TruncateTask.h"
#include <errno.h>
#include "messageFormat.h"
#include "SMLogging.h"
using namespace std;
@@ -25,6 +26,7 @@ TruncateTask::~TruncateTask()
bool TruncateTask::run()
{
SMLogging* logger = SMLogging::get();
bool success;
uint8_t buf[1024] = {0};
@@ -38,7 +40,7 @@ bool TruncateTask::run()
truncate_cmd *cmd = (truncate_cmd *) buf;
#ifdef SM_TRACE
syslog(LOG_DEBUG, "truncate %s newlength %i.",cmd->filename,cmd->length);
logger->log(LOG_DEBUG,"truncate %s newlength %i.",cmd->filename,cmd->length);
#endif
int err = ioc->truncate(cmd->filename, cmd->length);

View File

@@ -2,6 +2,7 @@
#include "UnlinkTask.h"
#include <errno.h>
#include "messageFormat.h"
#include "SMLogging.h"
using namespace std;
@@ -26,6 +27,7 @@ UnlinkTask::~UnlinkTask()
bool UnlinkTask::run()
{
SMLogging* logger = SMLogging::get();
bool success;
uint8_t buf[1024] = {0};
@@ -39,7 +41,7 @@ bool UnlinkTask::run()
unlink_cmd *cmd = (unlink_cmd *) buf;
#ifdef SM_TRACE
syslog(LOG_DEBUG, "unlink %s.",cmd->filename);
logger->log(LOG_DEBUG,"unlink %s.",cmd->filename);
#endif
int err = ioc->unlink(cmd->filename);

View File

@@ -2,6 +2,7 @@
#include "WriteTask.h"
#include "messageFormat.h"
#include "IOCoordinator.h"
#include "SMLogging.h"
#include <errno.h>
using namespace std;
@@ -28,6 +29,7 @@ WriteTask::~WriteTask()
bool WriteTask::run()
{
SMLogging* logger = SMLogging::get();
bool success;
uint8_t cmdbuf[1024] = {0};
@@ -44,7 +46,7 @@ bool WriteTask::run()
check_error("WriteTask read", false);
#ifdef SM_TRACE
syslog(LOG_DEBUG, "write filename %s offset %i count %i.",cmd->filename,cmd->offset,cmd->count);
logger->log(LOG_DEBUG,"write filename %s offset %i count %i.",cmd->filename,cmd->offset,cmd->count);
#endif
size_t readCount = 0, writeCount = 0;

View File

@@ -8,10 +8,10 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <syslog.h>
using namespace std;
#include "SMLogging.h"
#include "SessionManager.h"
using namespace storagemanager;
@@ -25,18 +25,14 @@ int main(int argc, char** argv)
int ret = 0;
//TODO: make this configurable
setlogmask (LOG_UPTO (LOG_DEBUG));
SMLogging* logger = SMLogging::get();
openlog ("StorageManager", LOG_PID | LOG_NDELAY, LOG_LOCAL2);
syslog(LOG_NOTICE, "StorageManager started.");
logger->log(LOG_NOTICE,"StorageManager started.");
SessionManager* sm = SessionManager::get();
ret = sm->start();
closelog ();
return ret;
}