mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 12:17:35 +03:00
logging fixes
This commit is contained in:
parent
f293045ace
commit
36e26436b5
7
Log.cpp
7
Log.cpp
@ -31,6 +31,10 @@ long g_dbufSize = 0;
|
|||||||
// main process id
|
// main process id
|
||||||
static pid_t s_pid = -1;
|
static pid_t s_pid = -1;
|
||||||
|
|
||||||
|
void Log::setPid ( ) {
|
||||||
|
s_pid = getpidtid();
|
||||||
|
}
|
||||||
|
|
||||||
Log::Log () {
|
Log::Log () {
|
||||||
m_fd = -1;
|
m_fd = -1;
|
||||||
m_filename = NULL;
|
m_filename = NULL;
|
||||||
@ -55,7 +59,8 @@ void Log::reset ( ) {
|
|||||||
|
|
||||||
bool Log::init ( char *filename ) {
|
bool Log::init ( char *filename ) {
|
||||||
// set the main process id
|
// set the main process id
|
||||||
s_pid = getpidtid();
|
//s_pid = getpidtid();
|
||||||
|
setPid();
|
||||||
// init these
|
// init these
|
||||||
m_numErrors = 0;
|
m_numErrors = 0;
|
||||||
m_bufPtr = 0;
|
m_bufPtr = 0;
|
||||||
|
2
Log.h
2
Log.h
@ -124,6 +124,8 @@ class Log {
|
|||||||
|
|
||||||
void reset ( );
|
void reset ( );
|
||||||
|
|
||||||
|
void setPid();
|
||||||
|
|
||||||
// save before exiting
|
// save before exiting
|
||||||
void close () { dumpLog(); };
|
void close () { dumpLog(); };
|
||||||
|
|
||||||
|
25
Threads.cpp
25
Threads.cpp
@ -178,17 +178,7 @@ Threads::Threads ( ) {
|
|||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Threads::init ( ) {
|
void Threads::setPid ( ) {
|
||||||
|
|
||||||
if ( m_initialized ) return true;
|
|
||||||
m_initialized = true;
|
|
||||||
|
|
||||||
m_needsCleanup = false;
|
|
||||||
//m_needBottom = false;
|
|
||||||
|
|
||||||
// sanity check
|
|
||||||
if ( sizeof(pthread_t) > sizeof(pid_t) ) { char *xx=NULL;*xx=0; }
|
|
||||||
|
|
||||||
// set s_pid to the main process id
|
// set s_pid to the main process id
|
||||||
#ifdef PTHREADS
|
#ifdef PTHREADS
|
||||||
s_pid = pthread_self();
|
s_pid = pthread_self();
|
||||||
@ -207,7 +197,20 @@ bool Threads::init ( ) {
|
|||||||
#else
|
#else
|
||||||
s_pid = getpid();
|
s_pid = getpid();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Threads::init ( ) {
|
||||||
|
|
||||||
|
if ( m_initialized ) return true;
|
||||||
|
m_initialized = true;
|
||||||
|
|
||||||
|
m_needsCleanup = false;
|
||||||
|
//m_needBottom = false;
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
if ( sizeof(pthread_t) > sizeof(pid_t) ) { char *xx=NULL;*xx=0; }
|
||||||
|
|
||||||
|
setPid();
|
||||||
|
|
||||||
#ifdef _STACK_GROWS_UP
|
#ifdef _STACK_GROWS_UP
|
||||||
return log("thread: Stack growing up not supported.");
|
return log("thread: Stack growing up not supported.");
|
||||||
|
@ -172,6 +172,7 @@ class Threads {
|
|||||||
|
|
||||||
long getStack ( ) ;
|
long getStack ( ) ;
|
||||||
void returnStack ( long si );
|
void returnStack ( long si );
|
||||||
|
void setPid();
|
||||||
void reset ( ) ;
|
void reset ( ) ;
|
||||||
|
|
||||||
// . we restrict the # of threads based on their type
|
// . we restrict the # of threads based on their type
|
||||||
|
@ -63,7 +63,7 @@ A work-in-progress <a href=/compare.html>comparison to SOLR</a>.
|
|||||||
<br><br><a name=quickstart></a>
|
<br><br><a name=quickstart></a>
|
||||||
<h1>Quick Start</h1>
|
<h1>Quick Start</h1>
|
||||||
|
|
||||||
Until I get the binary packages ready, <a href=#src>build from the source code</a>, it's easy.
|
Until I get the binary packages ready, <a href=#src>build from the source code</a>, it should only take about 30 seconds to type the three commands.
|
||||||
<!--
|
<!--
|
||||||
Requirements: You will need an Intel or AMD system running Linux and at least 4GB of RAM.<br><br>
|
Requirements: You will need an Intel or AMD system running Linux and at least 4GB of RAM.<br><br>
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ You will need the following packages installed<br>
|
|||||||
|
|
||||||
<b>1.</b> Do <b>apt-get install make g++ gcc-multilib lib32stdc++6</b>
|
<b>1.</b> Do <b>apt-get install make g++ gcc-multilib lib32stdc++6</b>
|
||||||
<br>
|
<br>
|
||||||
<b>2.</b> Download the <a href=https://github.com/gigablast/open-source-search-engine/archive/master.zip>Gigablast source code</a>, unzip it and cd into it. Alternatively, clone it from <a href=https://github.com/gigablast/open-source-search-engine>Gigablast on Github</a>.
|
<b>2.</b> Download the <a href=https://github.com/gigablast/open-source-search-engine>Gigablast source code</a> using <b>wget --no-check-certificate "https://github.com/gigablast/open-source-search-engine/archive/master.zip"</b>, unzip it and cd into it.
|
||||||
<br>
|
<br>
|
||||||
<b>3.</b> Run <b>make</b> to compile. (e.g. use 'make -j 4' to compile on four cores)
|
<b>3.</b> Run <b>make</b> to compile. (e.g. use 'make -j 4' to compile on four cores)
|
||||||
<br>
|
<br>
|
||||||
|
2
main.cpp
2
main.cpp
@ -2766,6 +2766,8 @@ int main2 ( int argc , char *argv[] ) {
|
|||||||
//fprintf(stderr,"done\n");
|
//fprintf(stderr,"done\n");
|
||||||
// set our new pid
|
// set our new pid
|
||||||
g_mem.setPid();
|
g_mem.setPid();
|
||||||
|
g_threads.setPid();
|
||||||
|
g_log.setPid();
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize threads down here now so it logs to the logfile and
|
// initialize threads down here now so it logs to the logfile and
|
||||||
|
Loading…
Reference in New Issue
Block a user