正在显示
2 个修改的文件
包含
4 行增加
和
6 行删除
| @@ -78,7 +78,7 @@ start() { | @@ -78,7 +78,7 @@ start() { | ||
| 78 | fi | 78 | fi |
| 79 | 79 | ||
| 80 | # check again after start server | 80 | # check again after start server |
| 81 | - sleep 0.5 | 81 | + sleep 1 |
| 82 | for ((i = 0; i < 5; i++)); do | 82 | for ((i = 0; i < 5; i++)); do |
| 83 | # sleep a little while, for srs may start then crash. | 83 | # sleep a little while, for srs may start then crash. |
| 84 | sleep 0.1 | 84 | sleep 0.1 |
| @@ -243,9 +243,8 @@ void SrsFastLog::write_log(char *str_log, int size, int _level) | @@ -243,9 +243,8 @@ void SrsFastLog::write_log(char *str_log, int size, int _level) | ||
| 243 | printf("\033[31m%s\033[0m", str_log); | 243 | printf("\033[31m%s\033[0m", str_log); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | - // if specified log file, write log to it. | ||
| 247 | - if (!_srs_config->get_srs_log_file().empty()) { | ||
| 248 | - if (fd < 0) { | 246 | + // open log file. |
| 247 | + if (!_srs_config->get_srs_log_file().empty() && fd < 0) { | ||
| 249 | std::string filename = _srs_config->get_srs_log_file(); | 248 | std::string filename = _srs_config->get_srs_log_file(); |
| 250 | 249 | ||
| 251 | fd = ::open(filename.c_str(), O_RDWR | O_APPEND); | 250 | fd = ::open(filename.c_str(), O_RDWR | O_APPEND); |
| @@ -257,9 +256,8 @@ void SrsFastLog::write_log(char *str_log, int size, int _level) | @@ -257,9 +256,8 @@ void SrsFastLog::write_log(char *str_log, int size, int _level) | ||
| 257 | ); | 256 | ); |
| 258 | } | 257 | } |
| 259 | } | 258 | } |
| 260 | - | 259 | + // write log to file. |
| 261 | if (fd > 0) { | 260 | if (fd > 0) { |
| 262 | ::write(fd, str_log, size); | 261 | ::write(fd, str_log, size); |
| 263 | } | 262 | } |
| 264 | - } | ||
| 265 | } | 263 | } |
-
请 注册 或 登录 后发表评论