fixed: when demonizing there were some logs info put twice in the log file

now we first demonize (fork) and then open the log file
added: start adding support for PT::Date 
       we are using instead of tz system structure



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@836 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-05-19 15:14:35 +00:00
parent 67099d5d06
commit 0df088e1e2
26 changed files with 1055 additions and 961 deletions

View File

@@ -96,6 +96,9 @@ int main(int argv, char ** argc)
if( !app.config.log_stdout )
CloseDescriptors();
if( app.config.demonize && !app.Demonize() )
return 4;
log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_file,
app.config.log_stdout, app.config.log_request);
@@ -104,16 +107,13 @@ int main(int argv, char ** argc)
log << log3 << "-- preparing to start winix --" << logend;
if( !app.InitFCGI() )
return false;
return 5;
if( !app.DropPrivileges() )
return 3;
app.LogUserGroups();
if( app.config.demonize && !app.Demonize() )
return 4;
log << log3 << "base_url: " << app.config.base_url << logend;
// load plugins before loading sessions - session_manager.LoadSessions()
@@ -124,8 +124,7 @@ int main(int argv, char ** argc)
if( !app.Init() )
return 1;
log.PutDate(log1);
log << "winix started" << logend;
log << log1 << PT::Date(std::time(0)) << " winix started" << logend;
app.StartThreads();
// now we have more threads, we should use Lock() and Unlock()
@@ -147,8 +146,7 @@ int main(int argv, char ** argc)
app.WaitForThreads();
// now all others threads are terminated
log.PutDate(log1);
log << "winix stopped" << logend << logsave;
log << log1 << PT::Date(std::time(0)) << " winix stopped" << logend << logsave;
return 0;
}