allow indexer and query tools to use different log files

This commit is contained in:
Jean-Francois Dockes 2015-12-01 14:31:33 +01:00
parent 2a48efc22b
commit 920567ca4c
3 changed files with 12 additions and 4 deletions

View file

@ -274,12 +274,19 @@ RclConfig *recollinit(RclInitFlags flags,
return 0; return 0;
} }
// Retrieve the log file name and level // Retrieve the log file name and level. Daemon and batch indexing
// processes may use specific values, else fall back on common
// ones.
string logfilename, loglevel; string logfilename, loglevel;
if (flags & RCLINIT_DAEMON) { if (flags & RCLINIT_DAEMON) {
config->getConfParam(string("daemlogfilename"), logfilename); config->getConfParam(string("daemlogfilename"), logfilename);
config->getConfParam(string("daemloglevel"), loglevel); config->getConfParam(string("daemloglevel"), loglevel);
} }
if ((flags & RCLINIT_IDX) && logfilename.empty())
config->getConfParam(string("idxlogfilename"), logfilename);
if ((flags & RCLINIT_IDX) && loglevel.empty())
config->getConfParam(string("idxloglevel"), loglevel);
if (logfilename.empty()) if (logfilename.empty())
config->getConfParam(string("logfilename"), logfilename); config->getConfParam(string("logfilename"), logfilename);
if (loglevel.empty()) if (loglevel.empty())

View file

@ -30,7 +30,8 @@ class RclConfig;
* up the global signal handling. other threads must call recoll_threadinit() * up the global signal handling. other threads must call recoll_threadinit()
* when starting. * when starting.
* *
* @param flags misc modifiers * @param flags misc modifiers. These are currently only used to customize
* the log file and verbosity.
* @param cleanup function to call before exiting (atexit) * @param cleanup function to call before exiting (atexit)
* @param sigcleanup function to call on terminal signal (INT/HUP...) This * @param sigcleanup function to call on terminal signal (INT/HUP...) This
* should typically set a flag which tells the program (recoll, * should typically set a flag which tells the program (recoll,
@ -41,7 +42,7 @@ class RclConfig;
* default and environment * default and environment
* @return the parsed configuration. * @return the parsed configuration.
*/ */
enum RclInitFlags {RCLINIT_NONE=0, RCLINIT_DAEMON=1}; enum RclInitFlags {RCLINIT_NONE=0, RCLINIT_DAEMON=1, RCLINIT_IDX=2};
extern RclConfig *recollinit(RclInitFlags flags, extern RclConfig *recollinit(RclInitFlags flags,
void (*cleanup)(void), void (*sigcleanup)(int), void (*cleanup)(void), void (*sigcleanup)(int),
string &reason, const string *argcnf = 0); string &reason, const string *argcnf = 0);

View file

@ -502,7 +502,7 @@ int main(int argc, char **argv)
} }
string reason; string reason;
RclInitFlags flags = (op_flags & OPT_m) && !(op_flags&OPT_D) ? RclInitFlags flags = (op_flags & OPT_m) && !(op_flags&OPT_D) ?
RCLINIT_DAEMON : RCLINIT_NONE; RCLINIT_DAEMON : RCLINIT_IDX;
config = recollinit(flags, cleanup, sigcleanup, reason, &a_config); config = recollinit(flags, cleanup, sigcleanup, reason, &a_config);
if (config == 0 || !config->ok()) { if (config == 0 || !config->ok()) {
cerr << "Configuration problem: " << reason << endl; cerr << "Configuration problem: " << reason << endl;