diff OrthancServer/main.cpp @ 1490:596927722403

support of --logdir by the internal logger
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Aug 2015 14:04:48 +0200
parents 1389834e130f
children 4f8c8ef114db
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Tue Aug 04 12:22:08 2015 +0200
+++ b/OrthancServer/main.cpp	Tue Aug 04 14:04:48 2015 +0200
@@ -652,7 +652,17 @@
 
     if (boost::starts_with(argv[i], "--logdir="))
     {
-      Logging::SetTargetFolder(std::string(argv[i]).substr(9));
+      std::string directory = std::string(argv[i]).substr(9);
+
+      try
+      {
+        Logging::SetTargetFolder(directory);
+      }
+      catch (OrthancException&)
+      {
+        fprintf(stderr, "The directory where to store the log files (%s) is inexistent, aborting.\n", directory.c_str());
+        return -1;
+      }
     }
 
     if (boost::starts_with(argv[i], "--config="))