Use ndn-cxx logging facility

refs: #3949

Change-Id: I5d0931c3576c88e0c2fa52bdd0a716946400e0bc
diff --git a/src/adjacency-list.cpp b/src/adjacency-list.cpp
index 9d02d7e..c41917c 100644
--- a/src/adjacency-list.cpp
+++ b/src/adjacency-list.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -29,7 +29,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("AdjacencyList");
+INIT_LOGGER(AdjacencyList);
 
 AdjacencyList::AdjacencyList()
 {
diff --git a/src/adjacent.cpp b/src/adjacent.cpp
index 0476878..183dcef 100644
--- a/src/adjacent.cpp
+++ b/src/adjacent.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -28,7 +28,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("Adjacent");
+INIT_LOGGER(Adjacent);
 
 const float Adjacent::DEFAULT_LINK_COST = 10.0;
 
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 047b5d2..01e4bd3 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -28,7 +28,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("SyncLogicHandler");
+INIT_LOGGER(SyncLogicHandler);
 
 const std::string NLSR_COMPONENT = "NLSR";
 const std::string LSA_COMPONENT = "LSA";
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index d13b415..e93ef35 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -287,52 +287,6 @@
     return false;
   }
 
-  // log-level
-  std::string logLevel = section.get<std::string>("log-level", "INFO");
-
-  if (isValidLogLevel(logLevel)) {
-    m_nlsr.getConfParameter().setLogLevel(logLevel);
-  }
-  else {
-    std::cerr << "Invalid value for log-level ";
-    std::cerr << "Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, NONE" << std::endl;
-    return false;
-  }
-
-  try {
-    std::string logDir = section.get<std::string>("log-dir");
-    if (boost::filesystem::exists(logDir)) {
-      if (boost::filesystem::is_directory(logDir)) {
-        std::string testFileName=logDir+"/test.log";
-        std::ofstream testOutFile;
-        testOutFile.open(testFileName.c_str());
-        if (testOutFile.is_open() && testOutFile.good()) {
-          m_nlsr.getConfParameter().setLogDir(logDir);
-        }
-        else {
-          std::cerr << "User does not have read and write permission on the directory";
-          std::cerr << std::endl;
-          return false;
-        }
-        testOutFile.close();
-        remove(testFileName.c_str());
-      }
-      else {
-        std::cerr << "Provided path is not a directory" << std::endl;
-        return false;
-      }
-    }
-    else {
-      std::cerr << "Provided log directory <" << logDir << "> does not exist" << std::endl;
-      return false;
-    }
-  }
-  catch (const std::exception& ex) {
-    std::cerr << "You must configure log directory" << std::endl;
-    std::cerr << ex.what() << std::endl;
-    return false;
-  }
-
   try {
     std::string seqDir = section.get<std::string>("seq-dir");
     if (boost::filesystem::exists(seqDir)) {
@@ -367,28 +321,6 @@
     return false;
   }
 
-  try {
-    std::string log4cxxPath = section.get<std::string>("log4cxx-conf");
-
-    if (log4cxxPath == "") {
-      std::cerr << "No value provided for log4cxx-conf" << std::endl;
-      return false;
-    }
-
-    if (boost::filesystem::exists(log4cxxPath)) {
-      m_nlsr.getConfParameter().setLog4CxxConfPath(log4cxxPath);
-    }
-    else {
-      std::cerr << "Provided path for log4cxx-conf <" << log4cxxPath
-                << "> does not exist" << std::endl;
-
-      return false;
-    }
-  }
-  catch (const std::exception& ex) {
-    // Variable is optional so default configuration will be used; continue processing file
-  }
-
   return true;
 }
 
diff --git a/src/conf-file-processor.hpp b/src/conf-file-processor.hpp
index d3e91c9..4218657 100644
--- a/src/conf-file-processor.hpp
+++ b/src/conf-file-processor.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -83,7 +83,7 @@
   bool
   processSection(const std::string& sectionName, const ConfigSection& section);
 
-  /*! \brief Parse general options, including router name, logging directory, LSA refresh.
+  /*! \brief Parse general options, including router name, LSA refresh.
    */
   bool
   processConfSectionGeneral(const ConfigSection& section);
diff --git a/src/conf-parameter.cpp b/src/conf-parameter.cpp
index 05a96dd..f0d41cb 100644
--- a/src/conf-parameter.cpp
+++ b/src/conf-parameter.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -26,7 +26,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("ConfParameter");
+INIT_LOGGER(ConfParameter);
 
 void
 ConfParameter::writeLog()
@@ -51,7 +51,6 @@
   for (auto const& value: m_corTheta) {
     NLSR_LOG_INFO("Hyp Angle " << i++ << ": "<< value);
   }
-  NLSR_LOG_INFO("Log Directory: " << m_logDir);
   NLSR_LOG_INFO("Seq Directory: " << m_seqFileDir);
 
   // Event Intervals
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index 00aa06a..ee22764 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -136,7 +136,6 @@
     , m_hyperbolicState(HYPERBOLIC_STATE_OFF)
     , m_corR(0)
     , m_maxFacesPerPrefix(MAX_FACES_PER_PREFIX_MIN)
-    , m_isLog4cxxConfAvailable(false)
   {
   }
 
@@ -410,18 +409,6 @@
   }
 
   void
-  setLogDir(const std::string& logDir)
-  {
-    m_logDir = logDir;
-  }
-
-  const std::string&
-  getLogDir() const
-  {
-    return m_logDir;
-  }
-
-  void
   setSeqFileDir(const std::string& ssfd)
   {
     m_seqFileDir = ssfd;
@@ -433,27 +420,6 @@
     return m_seqFileDir;
   }
 
-  bool
-  isLog4CxxConfAvailable() const
-  {
-    return m_isLog4cxxConfAvailable;
-  }
-
-  void
-  setLog4CxxConfPath(const std::string& path)
-  {
-    m_log4CxxConfPath = path;
-    m_isLog4cxxConfAvailable = true;
-  }
-
-  const std::string&
-  getLog4CxxConfPath() const
-  {
-    return m_log4CxxConfPath;
-  }
-
-  /*! \brief Dump the current state of all attributes to the log.
-   */
   void
   writeLog();
 
@@ -492,11 +458,8 @@
 
   uint32_t m_maxFacesPerPrefix;
 
-  std::string m_logDir;
   std::string m_seqFileDir;
 
-  bool m_isLog4cxxConfAvailable;
-  std::string m_log4CxxConfPath;
 };
 
 } // namespace nlsr
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index fbb4f5b..0c2d2d3 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -27,7 +27,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("HelloProtocol");
+INIT_LOGGER(HelloProtocol);
 
 const std::string HelloProtocol::INFO_COMPONENT = "INFO";
 const std::string HelloProtocol::NLSR_COMPONENT = "NLSR";
diff --git a/src/logger.cpp b/src/logger.cpp
deleted file mode 100644
index c51cd93..0000000
--- a/src/logger.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  The University of Memphis,
- *                           Regents of the University of California
- *
- * This file is part of NLSR (Named-data Link State Routing).
- * See AUTHORS.md for complete list of NLSR authors and contributors.
- *
- * NLSR 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 3 of the License, or (at your option) any later version.
- *
- * NLSR 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
- * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "logger.hpp"
-
-#include <log4cxx/logger.h>
-#include <log4cxx/basicconfigurator.h>
-#include <log4cxx/xml/domconfigurator.h>
-#include <log4cxx/propertyconfigurator.h>
-#include <log4cxx/patternlayout.h>
-#include <log4cxx/level.h>
-#include <log4cxx/helpers/exception.h>
-#include <log4cxx/rollingfileappender.h>
-
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-
-void
-INIT_LOG4CXX(const std::string& log4cxxConfPath)
-{
-  if (boost::filesystem::path(log4cxxConfPath).extension().string() == ".xml") {
-    log4cxx::xml::DOMConfigurator::configure(log4cxxConfPath);
-  }
-  else {
-    log4cxx::PropertyConfigurator::configure(log4cxxConfPath);
-  }
-}
-
-void
-INIT_LOGGERS(const std::string& logDir, const std::string& logLevel)
-{
-  static bool configured = false;
-
-  if (configured) {
-    return;
-  }
-
-  log4cxx::PatternLayoutPtr
-           layout(new log4cxx::PatternLayout("%date{%s}.%date{SSS} %p: [%c] %m%n"));
-
-  log4cxx::RollingFileAppender* rollingFileAppender =
-           new log4cxx::RollingFileAppender(layout, logDir+"/nlsr.log", true);
-
-  rollingFileAppender->setMaxFileSize("10MB");
-  rollingFileAppender->setMaxBackupIndex(10);
-
-  log4cxx::helpers::Pool p;
-  rollingFileAppender->activateOptions(p);
-
-  log4cxx::BasicConfigurator::configure(log4cxx::AppenderPtr(rollingFileAppender));
-
-  if (boost::iequals(logLevel, "none")) {
-    log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getOff());
-  }
-  else {
-    log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::toLevel(logLevel));
-  }
-
-  configured = true;
-}
-
-bool
-isValidLogLevel(const std::string& logLevel)
-{
-  return boost::iequals(logLevel, "all")   || boost::iequals(logLevel, "trace") ||
-         boost::iequals(logLevel, "debug") || boost::iequals(logLevel, "info")  ||
-         boost::iequals(logLevel, "warn")  || boost::iequals(logLevel, "error") ||
-         boost::iequals(logLevel, "none");
-}
diff --git a/src/logger.hpp b/src/logger.hpp
index 2236266..7925107 100644
--- a/src/logger.hpp
+++ b/src/logger.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -30,36 +30,15 @@
 #ifndef NLSR_LOGGER_HPP
 #define NLSR_LOGGER_HPP
 
-#include <log4cxx/logger.h>
+#include <ndn-cxx/util/logger.hpp>
 
-#define INIT_LOGGER(name) \
-  static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger(name)
+#define INIT_LOGGER(name) NDN_LOG_INIT(nlsr.name)
 
-#define NLSR_LOG_TRACE(x) \
-  LOG4CXX_TRACE(staticModuleLogger, x)
-
-#define NLSR_LOG_DEBUG(x) \
-  LOG4CXX_DEBUG(staticModuleLogger, x)
-
-#define NLSR_LOG_INFO(x) \
-  LOG4CXX_INFO(staticModuleLogger, x)
-
-#define NLSR_LOG_WARN(x) \
-  LOG4CXX_WARN(staticModuleLogger, x)
-
-#define NLSR_LOG_ERROR(x) \
-  LOG4CXX_ERROR(staticModuleLogger, x)
-
-#define NLSR_LOG_FATAL(x) \
-  LOG4CXX_FATAL(staticModuleLogger, x);
-
-void
-INIT_LOGGERS(const std::string& logDir, const std::string& logLevel);
-
-void
-INIT_LOG4CXX(const std::string& log4cxxConfPath);
-
-bool
-isValidLogLevel(const std::string& logLevel);
+#define NLSR_LOG_TRACE(x) NDN_LOG_TRACE(x)
+#define NLSR_LOG_DEBUG(x) NDN_LOG_DEBUG(x)
+#define NLSR_LOG_INFO(x) NDN_LOG_INFO(x)
+#define NLSR_LOG_WARN(x) NDN_LOG_WARN(x)
+#define NLSR_LOG_ERROR(x) NDN_LOG_ERROR(x)
+#define NLSR_LOG_FATAL(x) NDN_LOG_FATAL(x)
 
 #endif // NLSR_LOGGER_HPP
diff --git a/src/lsa.cpp b/src/lsa.cpp
index 91f6a7a..84bd5fe 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -35,7 +35,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("Lsa");
+INIT_LOGGER(Lsa);
 
 std::string
 Lsa::getData() const
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 6df2346..536d154 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -31,7 +31,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("Lsdb");
+INIT_LOGGER(Lsdb);
 
 class LsaContentPublisher : public SegmentPublisher<ndn::Face>
 {
@@ -1096,7 +1096,8 @@
   lsaIncrementSignal(Statistics::PacketType::RCV_NAME_LSA_INTEREST);
   NLSR_LOG_DEBUG("nameLsa interest " << interest << " received");
   NameLsa*  nameLsa = m_nlsr.getLsdb().findNameLsa(lsaKey);
-  if (nameLsa != 0) {
+  if (nameLsa != nullptr) {
+    NLSR_LOG_TRACE("Verifying SeqNo for NameLsa is same as requested.");
     if (nameLsa->getLsSeqNo() == seqNo) {
       std::string content = nameLsa->serialize();
       putLsaData(interest,content);
@@ -1130,7 +1131,8 @@
   lsaIncrementSignal(Statistics::PacketType::RCV_ADJ_LSA_INTEREST);
   NLSR_LOG_DEBUG("AdjLsa interest " << interest << " received");
   AdjLsa* adjLsa = m_nlsr.getLsdb().findAdjLsa(lsaKey);
-  if (adjLsa != 0) {
+  if (adjLsa != nullptr) {
+    NLSR_LOG_TRACE("Verifying SeqNo for AdjLsa is same as requested.");
     if (adjLsa->getLsSeqNo() == seqNo) {
       std::string content = adjLsa->serialize();
       putLsaData(interest,content);
@@ -1164,7 +1166,8 @@
   lsaIncrementSignal(Statistics::PacketType::RCV_COORD_LSA_INTEREST);
   NLSR_LOG_DEBUG("CoordinateLsa interest " << interest << " received");
   CoordinateLsa* corLsa = m_nlsr.getLsdb().findCoordinateLsa(lsaKey);
-  if (corLsa != 0) {
+  if (corLsa != nullptr) {
+    NLSR_LOG_TRACE("Verifying SeqNo for CoordinateLsa is same as requested.");
     if (corLsa->getLsSeqNo() == seqNo) {
       std::string content = corLsa->serialize();
       putLsaData(interest,content);
diff --git a/src/main.cpp b/src/main.cpp
index c01f8d4..eb336de 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -30,7 +30,6 @@
   std::string programName(argv[0]);
 
   std::string configFileName = "nlsr.conf";
-  bool isDaemonProcess = false;
 
   int32_t opt;
   while ((opt = getopt(argc, argv, "df:hV")) != -1) {
@@ -38,9 +37,6 @@
       case 'f':
         configFileName = optarg;
         break;
-      case 'd':
-        isDaemonProcess = true;
-        break;
       case 'V':
         std::cout << NLSR_VERSION_BUILD_STRING << std::endl;
         return EXIT_SUCCESS;
@@ -52,7 +48,7 @@
     }
   }
 
-  NlsrRunner runner(configFileName, isDaemonProcess);
+  NlsrRunner runner(configFileName);
 
   try {
     runner.run();
diff --git a/src/name-prefix-list.cpp b/src/name-prefix-list.cpp
index 486e350..26f54d4 100644
--- a/src/name-prefix-list.cpp
+++ b/src/name-prefix-list.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -21,18 +21,13 @@
 
 #include "name-prefix-list.hpp"
 #include "common.hpp"
-#include "logger.hpp"
 
 #include <iostream>
 #include <algorithm>
 
 namespace nlsr {
 
-INIT_LOGGER("NamePrefixList");
-
-NamePrefixList::NamePrefixList()
-{
-}
+NamePrefixList::NamePrefixList() = default;
 
 NamePrefixList::NamePrefixList(const std::initializer_list<ndn::Name>& names)
 {
diff --git a/src/nlsr-runner.cpp b/src/nlsr-runner.cpp
index 652139f..7f27f45 100644
--- a/src/nlsr-runner.cpp
+++ b/src/nlsr-runner.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -20,21 +20,19 @@
  **/
 
 #include "nlsr-runner.hpp"
-
 #include "conf-file-processor.hpp"
 #include "logger.hpp"
 
 namespace nlsr {
 
-INIT_LOGGER("NlsrRunner");
+INIT_LOGGER(NlsrRunner);
 
-NlsrRunner::NlsrRunner(std::string& configFileName, bool isDaemonProcess)
+NlsrRunner::NlsrRunner(std::string& configFileName)
   : m_scheduler(m_ioService)
   , m_face(m_ioService)
   , m_nlsr(m_ioService, m_scheduler, m_face, m_keyChain)
 {
   m_nlsr.setConfFileName(configFileName);
-  m_nlsr.setIsDaemonProcess(isDaemonProcess);
 }
 
 void
@@ -46,17 +44,6 @@
     BOOST_THROW_EXCEPTION(Error("Error in configuration file processing! Exiting from NLSR"));
   }
 
-  if (m_nlsr.getConfParameter().isLog4CxxConfAvailable()) {
-    INIT_LOG4CXX(m_nlsr.getConfParameter().getLog4CxxConfPath());
-  }
-  else {
-    INIT_LOGGERS(m_nlsr.getConfParameter().getLogDir(), m_nlsr.getConfParameter().getLogLevel());
-  }
-
-  if (m_nlsr.getIsSetDaemonProcess()) {
-    m_nlsr.daemonize();
-  }
-
   /** Because URI canonization needs to occur before initialization,
       we have to pass initialize as the finally() in neighbor
       canonization.
@@ -86,7 +73,6 @@
 {
   std::cout << "Usage: " << programName << " [OPTIONS...]" << std::endl;
   std::cout << "   NDN routing...." << std::endl;
-  std::cout << "       -d          Run in daemon mode" << std::endl;
   std::cout << "       -f <FILE>   Specify configuration file name" << std::endl;
   std::cout << "       -V          Display version information" << std::endl;
   std::cout << "       -h          Display this help message" << std::endl;
diff --git a/src/nlsr-runner.hpp b/src/nlsr-runner.hpp
index 7d4505e..76d0456 100644
--- a/src/nlsr-runner.hpp
+++ b/src/nlsr-runner.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -36,11 +36,11 @@
  *
  * As its name suggests, this class is responsible for running
  * NLSR. It creates an nlsr::ConfFileProcessor to read a configuration
- * file and uses that to configure and then start an NLSR process. It
- * also initializes loggers and optionally daemonizes the NLSR
- * process. This class only exists to provide this functionality, and
- * there is no special reliance of NLSR on this class.
+ * file and uses that to configure and then start an NLSR process.
+ * This class only exists to provide this functionality, and there is
+ * no special reliance of NLSR on this class.
  */
+
 class NlsrRunner
 {
 public:
@@ -54,7 +54,8 @@
     }
   };
 
-  NlsrRunner(std::string& configFileName, bool isDaemonProcess);
+  explicit
+  NlsrRunner(std::string& configFileName);
 
   /*! \brief Instantiate, configure, and start the NLSR process.
    *
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index ab4a073..583fdcb 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -34,7 +34,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("nlsr");
+INIT_LOGGER(Nlsr);
 
 const ndn::Name Nlsr::LOCALHOST_PREFIX = ndn::Name("/localhost/nlsr");
 
@@ -45,7 +45,6 @@
   , m_confParam()
   , m_adjacencyList()
   , m_namePrefixList()
-  , m_isDaemonProcess(false)
   , m_configFileName("nlsr.conf")
   , m_nlsrLsdb(*this, scheduler)
   , m_adjBuildCount(0)
@@ -149,32 +148,6 @@
 }
 
 void
-Nlsr::daemonize()
-{
-  pid_t process_id = 0;
-  pid_t sid = 0;
-  process_id = fork();
-  if (process_id < 0){
-    std::cerr << "Daemonization failed!" << std::endl;
-    BOOST_THROW_EXCEPTION(Error("Error: Daemonization process- fork failed!"));
-  }
-  if (process_id > 0) {
-    NLSR_LOG_DEBUG("Process daemonized. Process id: " << process_id);
-    exit(0);
-  }
-
-  umask(0);
-  sid = setsid();
-  if(sid < 0) {
-    BOOST_THROW_EXCEPTION(Error("Error: Daemonization process- setting id failed!"));
-  }
-
-  if (chdir("/") < 0) {
-    BOOST_THROW_EXCEPTION(Error("Error: Daemonization process-chdir failed!"));
-  }
-}
-
-void
 Nlsr::canonizeContinuation(std::list<Adjacent>::iterator iterator,
                            std::function<void(void)> finally)
 {
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 10999d2..0a29184 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -117,18 +117,6 @@
     m_configFileName = fileName;
   }
 
-  bool
-  getIsSetDaemonProcess()
-  {
-    return m_isDaemonProcess;
-  }
-
-  void
-  setIsDaemonProcess(bool value)
-  {
-    m_isDaemonProcess = value;
-  }
-
   ConfParameter&
   getConfParameter()
   {
@@ -364,9 +352,6 @@
   void
   setStrategies();
 
-  void
-  daemonize();
-
   uint32_t
   getFirstHelloInterval() const
   {
@@ -479,7 +464,6 @@
   ConfParameter m_confParam;
   AdjacencyList m_adjacencyList;
   NamePrefixList m_namePrefixList;
-  bool m_isDaemonProcess;
   std::string m_configFileName;
   Lsdb m_nlsrLsdb;
   int64_t m_adjBuildCount;
diff --git a/src/publisher/dataset-interest-handler.cpp b/src/publisher/dataset-interest-handler.cpp
index efd76f8..15a1eea 100644
--- a/src/publisher/dataset-interest-handler.cpp
+++ b/src/publisher/dataset-interest-handler.cpp
@@ -29,7 +29,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("DatasetInterestHandler");
+INIT_LOGGER(DatasetInterestHandler);
 
 const ndn::PartialName ADJACENCIES_DATASET = ndn::PartialName("lsdb/adjacencies");
 const ndn::PartialName COORDINATES_DATASET = ndn::PartialName("lsdb/coordinates");
diff --git a/src/route/face-map.cpp b/src/route/face-map.cpp
index 95a37bf..52026d0 100644
--- a/src/route/face-map.cpp
+++ b/src/route/face-map.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -29,7 +29,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("FaceMap");
+INIT_LOGGER(route.FaceMap);
 
 void
 FaceMap::writeLog()
diff --git a/src/route/fib-entry.cpp b/src/route/fib-entry.cpp
index 4a4498a..a3186b3 100644
--- a/src/route/fib-entry.cpp
+++ b/src/route/fib-entry.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -23,7 +23,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("FibEntry");
+INIT_LOGGER(route.FibEntry);
 
 void
 FibEntry::writeLog()
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index c2ba20d..d472920 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -31,7 +31,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("Fib");
+INIT_LOGGER(route.Fib);
 
 const uint64_t Fib::GRACE_PERIOD = 10;
 
diff --git a/src/route/map.cpp b/src/route/map.cpp
index 82f73b0..a3ca7d1 100644
--- a/src/route/map.cpp
+++ b/src/route/map.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -25,12 +25,9 @@
 #include "lsdb.hpp"
 #include "logger.hpp"
 
-#include <iostream>
-#include <list>
-
 namespace nlsr {
 
-INIT_LOGGER("Map");
+INIT_LOGGER(route.Map);
 
 void
 Map::addEntry(const ndn::Name& rtrName)
diff --git a/src/route/name-prefix-table-entry.cpp b/src/route/name-prefix-table-entry.cpp
index 2403003..ac4c3ec 100644
--- a/src/route/name-prefix-table-entry.cpp
+++ b/src/route/name-prefix-table-entry.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -27,7 +27,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("NamePrefixTableEntry");
+INIT_LOGGER(route.NamePrefixTableEntry);
 
 void
 NamePrefixTableEntry::generateNhlfromRteList()
diff --git a/src/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index 4496f6c..d2e8527 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -31,7 +31,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("NamePrefixTable");
+INIT_LOGGER(route.NamePrefixTable);
 
 NamePrefixTable::NamePrefixTable(Nlsr& nlsr,
                                  std::unique_ptr<AfterRoutingChange>& afterRoutingChangeSignal)
diff --git a/src/route/nexthop-list.cpp b/src/route/nexthop-list.cpp
index a0a585a..698e06a 100644
--- a/src/route/nexthop-list.cpp
+++ b/src/route/nexthop-list.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -26,7 +26,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("NexthopList");
+INIT_LOGGER(route.NexthopList);
 
 static bool
 nexthopAddCompare(const NextHop& nh1, const NextHop& nh2)
diff --git a/src/route/routing-table-calculator.cpp b/src/route/routing-table-calculator.cpp
index c7b7d08..a35df65 100644
--- a/src/route/routing-table-calculator.cpp
+++ b/src/route/routing-table-calculator.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -33,7 +33,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("RoutingTableCalculator");
+INIT_LOGGER(route.RoutingTableCalculator);
 
 void
 RoutingTableCalculator::allocateAdjMatrix()
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 81fb9cb..1f88c87 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -32,7 +32,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("RoutingTable");
+INIT_LOGGER(route.RoutingTable);
 
 RoutingTable::RoutingTable(ndn::Scheduler& scheduler)
   : afterRoutingChange{ndn::make_unique<AfterRoutingChange>()}
diff --git a/src/sequencing-manager.cpp b/src/sequencing-manager.cpp
index cdcbad9..ac2bb54 100644
--- a/src/sequencing-manager.cpp
+++ b/src/sequencing-manager.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -32,7 +32,7 @@
 
 namespace nlsr {
 
-INIT_LOGGER("SequencingManager");
+INIT_LOGGER(SequencingManager);
 
 void
 SequencingManager::writeSeqNoToFile() const
diff --git a/src/tlv/coordinate-lsa.cpp b/src/tlv/coordinate-lsa.cpp
index 02509a0..ab39fe8 100644
--- a/src/tlv/coordinate-lsa.cpp
+++ b/src/tlv/coordinate-lsa.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -21,7 +21,6 @@
 
 #include "coordinate-lsa.hpp"
 #include "tlv-nlsr.hpp"
-#include "logger.hpp"
 
 #include <ndn-cxx/util/concepts.hpp>
 #include <ndn-cxx/encoding/block-helpers.hpp>
@@ -31,8 +30,6 @@
 namespace nlsr {
 namespace tlv {
 
-INIT_LOGGER("CoordinateLsa");
-
 BOOST_CONCEPT_ASSERT((ndn::WireEncodable<CoordinateLsa>));
 BOOST_CONCEPT_ASSERT((ndn::WireDecodable<CoordinateLsa>));
 static_assert(std::is_base_of<ndn::tlv::Error, CoordinateLsa::Error>::value,
diff --git a/src/update/manager-base.cpp b/src/update/manager-base.cpp
index a93aaba..071fc3a 100644
--- a/src/update/manager-base.cpp
+++ b/src/update/manager-base.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -25,7 +25,7 @@
 namespace nlsr {
 namespace update {
 
-INIT_LOGGER("UpdatePrefixCommandProcessor");
+INIT_LOGGER(update.PrefixCommandProcessor);
 
 ManagerBase::ManagerBase(ndn::mgmt::Dispatcher& dispatcher,
                          const std::string& module)
diff --git a/src/update/nfd-rib-command-processor.cpp b/src/update/nfd-rib-command-processor.cpp
index 23a86eb..331a3ca 100644
--- a/src/update/nfd-rib-command-processor.cpp
+++ b/src/update/nfd-rib-command-processor.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -20,13 +20,10 @@
  **/
 
 #include "nfd-rib-command-processor.hpp"
-#include "logger.hpp"
 
 namespace nlsr {
 namespace update {
 
-INIT_LOGGER("NfdRibProcessor");
-
 NfdRibCommandProcessor::NfdRibCommandProcessor(ndn::mgmt::Dispatcher& dispatcher,
                                                NamePrefixList& namePrefixList,
                                                Lsdb& lsdb)
diff --git a/src/update/prefix-update-processor.cpp b/src/update/prefix-update-processor.cpp
index 478380f..26adefd 100644
--- a/src/update/prefix-update-processor.cpp
+++ b/src/update/prefix-update-processor.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2017,  The University of Memphis,
+ * Copyright (c) 2014-2018,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -29,7 +29,7 @@
 namespace nlsr {
 namespace update {
 
-INIT_LOGGER("PrefixUpdateProcessor");
+INIT_LOGGER(update.PrefixUpdateProcessor);
 
 /** \brief an Interest tag to indicate command signer
  */