diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index f40a25f9b..d7b060555 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -21,8 +21,10 @@ ff_log_dir ./objs/logs; # the log tank, console or file. # if console, print log to console. # if file, write log to file. requires srs_log_file if log to file. -# default: console. -srs_log_tank console; +# default: file. +srs_log_tank file; +# when srs_log_tank is file, specifies the log file. +# default: ./objs/srs.log srs_log_file ./objs/srs.log; # the max connections. # if exceed the max connections, server will drop the new connection. diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 786610ebf..cf3164015 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -1282,7 +1282,7 @@ string SrsConfig::get_srs_log_file() SrsConfDirective* conf = root->get("srs_log_file"); if (!conf || conf->arg0().empty()) { - return ""; + return "./objs/srs.log"; } return conf->arg0(); @@ -1293,11 +1293,11 @@ bool SrsConfig::get_srs_log_tank_file() srs_assert(root); SrsConfDirective* conf = root->get("srs_log_tank"); - if (conf && conf->arg0() == "file") { - return true; + if (conf && conf->arg0() == "console") { + return false; } - return false; + return true; } bool SrsConfig::get_deamon() diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 1984935aa..fea5db52b 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -61,6 +61,10 @@ int run_master() signal(SIGTERM, handler); signal(SIGINT, handler); + if ((ret = _srs_server->acquire_pid_file()) != ERROR_SUCCESS) { + return ret; + } + if ((ret = _srs_server->initialize_st()) != ERROR_SUCCESS) { return ret; } @@ -161,9 +165,5 @@ int main(int argc, char** argv) return ret; } - if ((ret = _srs_server->acquire_pid_file()) != ERROR_SUCCESS) { - return ret; - } - return run(); }