This commit is contained in:
rjawor 2015-09-07 09:06:06 +02:00
parent 08502caa38
commit 337d4c7122
5 changed files with 10 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
build/
logs/concordia-server.log
concordia.cfg
concordia-server/config.hpp
index/

View File

@ -45,6 +45,7 @@ configure_file (
)
set(CONFIG_FILE_PATH "${concordia-server_SOURCE_DIR}/concordia.cfg")
set(LOG_FILE_PATH "${concordia-server_SOURCE_DIR}/logs/concordia-server.log")
# --------------
# db settings

View File

@ -65,6 +65,7 @@ std::string ConcordiaServer::handleRequest(std::string & requestString) {
_searcherController->simpleSearch(jsonWriter, pattern);
} else if (operation == CONCORDIA_SEARCH_OP) {
std::string pattern = d[PATTERN_PARAM].GetString();
Logger::logString("concordia search pattern", pattern);
_searcherController->concordiaSearch(jsonWriter, pattern);
} else {
JsonGenerator::signalError(jsonWriter, "no such operation");

View File

@ -1,4 +1,5 @@
#define CONFIG_FILE_PATH "@CONFIG_FILE_PATH@"
#define LOG_FILE_PATH "@LOG_FILE_PATH@"
// database connection information
#define DB_NAME "@DB_NAME@"

View File

@ -2,9 +2,10 @@
#include "log4cpp/Appender.hh"
#include "log4cpp/FileAppender.hh"
#include "log4cpp/BasicLayout.hh"
#include "log4cpp/PatternLayout.hh"
#include "log4cpp/Priority.hh"
#include "config.hpp"
#include <sstream>
Logger::Logger() {
@ -44,8 +45,10 @@ void Logger::logString(std::string name, std::string value) {
}
void Logger::_initialize(log4cpp::Category & root) {
log4cpp::Appender *appender = new log4cpp::FileAppender("default", "/tmp/concordia-server.log");
appender->setLayout(new log4cpp::BasicLayout());
log4cpp::Appender *appender = new log4cpp::FileAppender("default", LOG_FILE_PATH);
log4cpp::PatternLayout *layout = new log4cpp::PatternLayout();
layout->setConversionPattern("%d{%Y-%m-%d %H:%M:%S}%c %x: %m%n");
appender->setLayout(layout);
root.setPriority(log4cpp::Priority::INFO);
root.addAppender(appender);