winlin

default write log to file.

@@ -21,8 +21,10 @@ ff_log_dir ./objs/logs; @@ -21,8 +21,10 @@ ff_log_dir ./objs/logs;
21 # the log tank, console or file. 21 # the log tank, console or file.
22 # if console, print log to console. 22 # if console, print log to console.
23 # if file, write log to file. requires srs_log_file if log to file. 23 # if file, write log to file. requires srs_log_file if log to file.
24 -# default: console.  
25 -srs_log_tank console; 24 +# default: file.
  25 +srs_log_tank file;
  26 +# when srs_log_tank is file, specifies the log file.
  27 +# default: ./objs/srs.log
26 srs_log_file ./objs/srs.log; 28 srs_log_file ./objs/srs.log;
27 # the max connections. 29 # the max connections.
28 # if exceed the max connections, server will drop the new connection. 30 # if exceed the max connections, server will drop the new connection.
@@ -1282,7 +1282,7 @@ string SrsConfig::get_srs_log_file() @@ -1282,7 +1282,7 @@ string SrsConfig::get_srs_log_file()
1282 1282
1283 SrsConfDirective* conf = root->get("srs_log_file"); 1283 SrsConfDirective* conf = root->get("srs_log_file");
1284 if (!conf || conf->arg0().empty()) { 1284 if (!conf || conf->arg0().empty()) {
1285 - return ""; 1285 + return "./objs/srs.log";
1286 } 1286 }
1287 1287
1288 return conf->arg0(); 1288 return conf->arg0();
@@ -1293,11 +1293,11 @@ bool SrsConfig::get_srs_log_tank_file() @@ -1293,11 +1293,11 @@ bool SrsConfig::get_srs_log_tank_file()
1293 srs_assert(root); 1293 srs_assert(root);
1294 1294
1295 SrsConfDirective* conf = root->get("srs_log_tank"); 1295 SrsConfDirective* conf = root->get("srs_log_tank");
1296 - if (conf && conf->arg0() == "file") {  
1297 - return true; 1296 + if (conf && conf->arg0() == "console") {
  1297 + return false;
1298 } 1298 }
1299 1299
1300 - return false; 1300 + return true;
1301 } 1301 }
1302 1302
1303 bool SrsConfig::get_deamon() 1303 bool SrsConfig::get_deamon()
@@ -61,6 +61,10 @@ int run_master() @@ -61,6 +61,10 @@ int run_master()
61 signal(SIGTERM, handler); 61 signal(SIGTERM, handler);
62 signal(SIGINT, handler); 62 signal(SIGINT, handler);
63 63
  64 + if ((ret = _srs_server->acquire_pid_file()) != ERROR_SUCCESS) {
  65 + return ret;
  66 + }
  67 +
64 if ((ret = _srs_server->initialize_st()) != ERROR_SUCCESS) { 68 if ((ret = _srs_server->initialize_st()) != ERROR_SUCCESS) {
65 return ret; 69 return ret;
66 } 70 }
@@ -161,9 +165,5 @@ int main(int argc, char** argv) @@ -161,9 +165,5 @@ int main(int argc, char** argv)
161 return ret; 165 return ret;
162 } 166 }
163 167
164 - if ((ret = _srs_server->acquire_pid_file()) != ERROR_SUCCESS) {  
165 - return ret;  
166 - }  
167 -  
168 return run(); 168 return run();
169 } 169 }