# HG changeset patch # User Sebastien Jodogne # Date 1349351049 -7200 # Node ID 80ca409f232f47fe37a6ea59bddde3210938b519 # Parent 0fc3b69c0357700962e7ac420b1d83484347e188 logging diff -r 0fc3b69c0357 -r 80ca409f232f OrthancServer/main.cpp --- a/OrthancServer/main.cpp Thu Oct 04 12:45:24 2012 +0200 +++ b/OrthancServer/main.cpp Thu Oct 04 13:44:09 2012 +0200 @@ -22,6 +22,7 @@ #include #include +#include #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" #include "../Core/HttpServer/FilesystemHttpHandler.h" @@ -96,15 +97,37 @@ { // Initialize Google's logging library. FLAGS_logtostderr = true; + + for (int i = 1; i < argc; i++) + { + if (boost::starts_with(argv[i], "--logdir=")) + { + FLAGS_logtostderr = false; + FLAGS_log_dir = std::string(argv[i]).substr(9); + } + } + google::InitGoogleLogging("Orthanc"); + try { + bool isInitialized = false; if (argc >= 2) { - OrthancInitialize(argv[1]); + for (int i = 1; i < argc; i++) + { + // Use the first argument that does not start with a "-" as + // the configuration file + if (argv[i][0] != '-') + { + OrthancInitialize(argv[i]); + isInitialized = true; + } + } } - else + + if (!isInitialized) { OrthancInitialize(); }