Add pylogfilename and pyloglevel functions to allow separating python logging. Unify recollinit calls
This commit is contained in:
+13
-3
@@ -274,7 +274,8 @@ RclConfig *recollinit(int flags,
|
||||
// to utf8 for indexing.
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
Logger::getTheLog("")->setLogLevel(Logger::LLDEB1);
|
||||
// Initially log to stderr, at error level.
|
||||
Logger::getTheLog("")->setLogLevel(Logger::LLERR);
|
||||
|
||||
initAsyncSigs(sigcleanup);
|
||||
|
||||
@@ -306,6 +307,14 @@ RclConfig *recollinit(int flags,
|
||||
config->getConfParam(string("idxloglevel"), loglevel);
|
||||
}
|
||||
}
|
||||
if (flags & RCLINIT_PYTHON) {
|
||||
if (logfilename.empty()) {
|
||||
config->getConfParam(string("pylogfilename"), logfilename);
|
||||
}
|
||||
if (loglevel.empty()) {
|
||||
config->getConfParam(string("pyloglevel"), loglevel);
|
||||
}
|
||||
}
|
||||
|
||||
if (logfilename.empty())
|
||||
config->getConfParam(string("logfilename"), logfilename);
|
||||
@@ -315,7 +324,7 @@ RclConfig *recollinit(int flags,
|
||||
// Initialize logging
|
||||
if (!logfilename.empty()) {
|
||||
logfilename = path_tildexpand(logfilename);
|
||||
// If not an absolute path or , compute relative to config dir
|
||||
// If not an absolute path or stderr, compute relative to config dir.
|
||||
if (!path_isabsolute(logfilename) &&
|
||||
logfilename.compare("stderr")) {
|
||||
logfilename = path_cat(config->getConfDir(), logfilename);
|
||||
@@ -372,7 +381,8 @@ RclConfig *recollinit(int flags,
|
||||
|
||||
int flushmb;
|
||||
if (config->getConfParam("idxflushmb", &flushmb) && flushmb > 0) {
|
||||
LOGDEB1("rclinit: idxflushmb=" << (flushmb) << ", set XAPIAN_FLUSH_THRESHOLD to 10E6\n" );
|
||||
LOGDEB1("rclinit: idxflushmb=" << flushmb <<
|
||||
", set XAPIAN_FLUSH_THRESHOLD to 10E6\n");
|
||||
static const char *cp = "XAPIAN_FLUSH_THRESHOLD=1000000";
|
||||
#ifdef PUTENV_ARG_CONST
|
||||
::putenv(cp);
|
||||
|
||||
@@ -39,16 +39,11 @@ class RclConfig;
|
||||
* default and environment
|
||||
* @return the parsed configuration.
|
||||
*/
|
||||
enum RclInitFlags {RCLINIT_NONE = 0, RCLINIT_DAEMON = 1, RCLINIT_IDX = 2};
|
||||
enum RclInitFlags {RCLINIT_NONE = 0, RCLINIT_DAEMON = 1, RCLINIT_IDX = 2,
|
||||
RCLINIT_PYTHON = 4};
|
||||
extern RclConfig *recollinit(int flags,
|
||||
void (*cleanup)(void), void (*sigcleanup)(int),
|
||||
std::string& reason, const std::string *argcnf = 0);
|
||||
inline RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
||||
std::string& reason,
|
||||
const std::string *argcnf = 0)
|
||||
{
|
||||
return recollinit(RCLINIT_NONE, cleanup, sigcleanup, reason, argcnf);
|
||||
}
|
||||
|
||||
// Threads need to call this to block signals.
|
||||
// The main thread handles all signals.
|
||||
|
||||
Reference in New Issue
Block a user