diff --git a/core/predictor/src/pdserving.cpp b/core/predictor/src/pdserving.cpp index 158602009e594fbc38d6eb3b5fc18f8fa7e0a7ab..bc628098cf9100cd3c732493e2db9bda56dbb0c9 100644 --- a/core/predictor/src/pdserving.cpp +++ b/core/predictor/src/pdserving.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #ifdef BCLOUD #include // bthread_set_worker_startfn @@ -135,16 +136,22 @@ int main(int argc, char** argv) { // google::ParseCommandLineFlags(&argc, &argv, true); g_change_server_port(); + std::string base_log_path = ""; + if (const char* serving_log_path = std::getenv("SERVING_LOG_PATH")) { + base_log_path = serving_log_path; + } // initialize logger instance #ifdef BCLOUD logging::LoggingSettings settings; settings.logging_dest = logging::LOG_TO_FILE; - + std::string log_dir = base_log_path + "./log/"; std::string filename(argv[0]); filename = filename.substr(filename.find_last_of('/') + 1); + + settings.log_file = - strdup((std::string("./log/") + filename + ".log").c_str()); + strdup((std::string(log_dir) + filename + ".log").c_str()); settings.delete_old = logging::DELETE_OLD_LOG_FILE; logging::InitLogging(settings); @@ -154,7 +161,7 @@ int main(int argc, char** argv) { logging::ComlogSink::GetInstance()->Setup(&cso); #else if (FLAGS_log_dir == "") { - FLAGS_log_dir = "./log"; + FLAGS_log_dir = base_log_path + "./log"; } struct stat st_buf; diff --git a/python/paddle_serving_server/env_check/run.py b/python/paddle_serving_server/env_check/run.py index 4268a9873d2a7e63682e57f3bf5b440511f66c63..c3d5ce4ff8790626e18cb8d69a77c94fdc80e496 100644 --- a/python/paddle_serving_server/env_check/run.py +++ b/python/paddle_serving_server/env_check/run.py @@ -34,7 +34,7 @@ log_files = ["PipelineServingLogs", "log", "stderr.log", "stdout.log"] def set_serving_log_path(): if 'SERVING_LOG_PATH' not in os.environ: - serving_log_path = os.path.expanduser(os.getcwd()) + serving_log_path = os.path.expanduser(os.getcwd()) + '/' os.environ['SERVING_LOG_PATH']=serving_log_path def mv_log_to_new_dir(dir_path):