将MindSpore运行结果输出到log文件
技术背景
我们在Linux系统下使用一些深度学习框架(如MindSpore)运行脚本的时候,经常会用一些打印输出来判断当前执行的步骤,或者是使用打印输出来定位算法问题。但是在Linux系统下程序输出其实被分成了正确输出和错误输出,如果只是在屏幕上打印的话,会将两种输出同时打印出来。但是如果要将打印的结果输出到某个文件里面的话,这时候正确输出和错误输出就是需要分开指定了。
指定方法
例如我们运行这样的一个MindSpore程序:
# test_log.py
import mindspore as ms
print (ms.__version__)
这个程序的内容非常简单,就是打印MindSpore的软件版本。并且为了对比输出的结果,我们把MindSpore的Log等级设置为1,也就是Debug级别,这个级别下运行MindSpore程序能够最充分的打印所有的提示信息:
$ export GLOG_v=1
然后看一下直接运行的结果:
$ python3 test_log.py
[INFO] ME(610566,7f71da597740,python3):2024-03-11-09:51:17.127.824 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.2 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(610566,7f71da597740,python3):2024-03-11-09:51:17.169.482 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.1 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(610566,7f71da597740,python3):2024-03-11-09:51:17.212.502 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_gpu.so.11.6 failed. libnvrtc.so.11.2: cannot open shared object file: No such file or directory
[INFO] ME(610566,7f71da597740,python3):2024-03-11-09:51:17.452.061 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:443] LoadPlugin] Load libmindspore_gpu plugin file /home/dechin/anaconda3/envs/mindsponge/lib/python3.9/site-packages/mindspore/lib/plugin/libmindspore_gpu.so.11.1 success, skip loading other version.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:17.481.273 [mindspore/ccsrc/pybind_api/ir/log_adapter_py.h:33] PyExceptionInitializer] Set exception handler
[ERROR] ME(610566:140126971328320,MainProcess):2024-03-11-09:51:17.520.283 [mindspore/run_check/_check_version.py:230] Cuda ['10.1', '11.1', '11.6'] version(libcudart*.so need by mindspore-gpu) is not found. Please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches. Please refer to the installation guidelines: https://www.mindspore.cn/install
[WARNING] ME(610566:140126971328320,MainProcess):2024-03-11-09:51:17.550.728 [mindspore/run_check/_check_version.py:98] Can not found cuda libs. Please confirm that the correct cuda version has been installed. Refer to the installation guidelines: https://www.mindspore.cn/install
[INFO] CORE(610566,7f71da597740,python3):2024-03-11-09:51:17.573.221 [mindspore/core/utils/ms_context.cc:382] SetDeviceTargetFromInner] ms set context device target:GPU
[INFO] PARALLEL(610566,7f71da597740,python3):2024-03-11-09:51:17.573.295 [mindspore/ccsrc/frontend/parallel/costmodel_context.cc:30] GetInstance] Create costmodel_context
[INFO] ME(610566:140126971328320,MainProcess):2024-03-11-09:51:17.573.510 [mindspore/run_check/_check_version.py:552] Setting the env `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` to prevent memory overflow during save or load checkpoint file.
2.2.11
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.365 [mindspore/ccsrc/pipeline/jit/ps/init.cc:527] operator()] Start releasing dataset handles...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.405 [mindspore/ccsrc/pipeline/jit/ps/init.cc:530] operator()] End release dataset handles.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.417 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2324] ClearResAtexit] Pipeline clear all resource
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.468 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:290] RecordExitStatus] Status record: system exit.
[INFO] DEBUG(610566,7f71da597740,python3):2024-03-11-09:51:18.689.491 [mindspore/ccsrc/common/debug/env_config_parser.cc:152] ParseFromFile] The 'env_config_path' in 'mindspore.context.set_context(env_config_path={path})' is empty.
[INFO] ME(610566,7f71da597740,python3):2024-03-11-09:51:18.689.539 [mindspore/core/mindrt/src/actor/actormgr.cc:153] Finalize] mindrt Actors finish exiting.
[INFO] ME(610566,7f71da597740,python3):2024-03-11-09:51:18.689.549 [mindspore/core/mindrt/src/actor/actormgr.cc:156] Finalize] mindrt Threads finish exiting.
[INFO] ME(610566,7f71da597740,python3):2024-03-11-09:51:18.689.559 [mindspore/core/mindrt/src/actor/actormgr.cc:167] Finalize] mindrt IOMGRS finish exiting.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.577 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2193] ClearResPart1] Start clear kernel runtime...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.590 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2195] ClearResPart1] End clear kernel runtime.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.599 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2198] ClearResPart1] Start Finalize StreamSynchronizer...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.689.613 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2200] ClearResPart1] End Finalize StreamSynchronizer...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.192 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:828] ClearRes] Clean executor resource!
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.207 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2214] ClearResPart2] Start clear PyNativeExecutor...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.271 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2216] ClearResPart2] End clear PyNativeExecutor.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.283 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2234] ClearResPart2] Start clear ConfigManager...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.293 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2236] ClearResPart2] End clear ConfigManager.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.304 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2247] ClearResPart2] Start clear device context...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.316 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2249] ClearResPart2] End clear device context.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.326 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2251] ClearResPart2] Start clear AnalysisResultCacheMgr...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.342 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2253] ClearResPart2] End clear AnalysisResultCacheMgr.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.352 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2255] ClearResPart2] Start clear AnalysisContext...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.363 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2257] ClearResPart2] End clear AnalysisContext...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.373 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2259] ClearResPart2] Start clear AnalysisSchedule...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.622 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2261] ClearResPart2] End clear AnalysisSchedule...
[INFO] DEBUG(610566,7f71da597740,python3):2024-03-11-09:51:18.690.647 [mindspore/ccsrc/debug/debugger/debugger.cc:101] Debugger] Debugger got device_target: GPU
[INFO] DEBUG(610566,7f71da597740,python3):2024-03-11-09:51:18.690.660 [mindspore/ccsrc/debug/debugger/debugger.cc:305] Reset] Release Debugger resource.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.684 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2274] ClearResPart3] Start clear ClearObjectCache...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.694 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2276] ClearResPart3] End clear ClearObjectCache...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.703 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2278] ClearResPart3] Start clear Parser...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.714 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2280] ClearResPart3] End clear Parser...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.723 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2282] ClearResPart3] Start ClearTraceStack...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.737 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2284] ClearResPart3] End ClearTraceStack...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.746 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2286] ClearResPart3] Start clear InterpretNodeRecorder...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.757 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2288] ClearResPart3] End clear InterpretNodeRecorder...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.767 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2290] ClearResPart3] Start clear parallel::entire_costgraph...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.778 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2292] ClearResPart3] End clear parallel::entire_costgraph...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.787 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2294] ClearResPart3] Start clear ProtobufLibrary...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.932 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2296] ClearResPart3] End clear ProtobufLibrary...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.943 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2298] ClearResPart3] Start clear python_adapter...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.952 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2300] ClearResPart3] End clear python_adapter.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.690.962 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2304] ClearSingleton] Start clear singleton...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.691.032 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2320] ClearSingleton] End clear singleton.
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.691.043 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2336] ClearResAtexit] Start unload dynamic lib...
[INFO] PIPELINE(610566,7f71da597740,python3):2024-03-11-09:51:18.691.060 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2338] ClearResAtexit] End unload dynamic lib...
此时屏幕上输出了所有的打印信息,那么下一步我们考虑把这些打印信息储存到一个log文件里面,常规的Linux输出到文件的指令就是python3 xxx.py > test.log这样,但是运行之后发现文件的输出跟屏幕上的输出是不一样的:
$ python3 test_log.py > test.log
[INFO] ME(611158,7f2b755a7740,python3):2024-03-11-09:59:27.899.071 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.2 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(611158,7f2b755a7740,python3):2024-03-11-09:59:27.941.986 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.1 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(611158,7f2b755a7740,python3):2024-03-11-09:59:27.986.889 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_gpu.so.11.6 failed. libnvrtc.so.11.2: cannot open shared object file: No such file or directory
[INFO] ME(611158,7f2b755a7740,python3):2024-03-11-09:59:28.219.045 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:443] LoadPlugin] Load libmindspore_gpu plugin file /home/dechin/anaconda3/envs/mindsponge/lib/python3.9/site-packages/mindspore/lib/plugin/libmindspore_gpu.so.11.1 success, skip loading other version.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:28.248.734 [mindspore/ccsrc/pybind_api/ir/log_adapter_py.h:33] PyExceptionInitializer] Set exception handler
[ERROR] ME(611158:139824629184320,MainProcess):2024-03-11-09:59:28.287.538 [mindspore/run_check/_check_version.py:230] Cuda ['10.1', '11.1', '11.6'] version(libcudart*.so need by mindspore-gpu) is not found. Please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches. Please refer to the installation guidelines: https://www.mindspore.cn/install
[WARNING] ME(611158:139824629184320,MainProcess):2024-03-11-09:59:28.320.427 [mindspore/run_check/_check_version.py:98] Can not found cuda libs. Please confirm that the correct cuda version has been installed. Refer to the installation guidelines: https://www.mindspore.cn/install
[INFO] CORE(611158,7f2b755a7740,python3):2024-03-11-09:59:28.347.675 [mindspore/core/utils/ms_context.cc:382] SetDeviceTargetFromInner] ms set context device target:GPU
[INFO] PARALLEL(611158,7f2b755a7740,python3):2024-03-11-09:59:28.347.747 [mindspore/ccsrc/frontend/parallel/costmodel_context.cc:30] GetInstance] Create costmodel_context
[INFO] ME(611158:139824629184320,MainProcess):2024-03-11-09:59:28.348.003 [mindspore/run_check/_check_version.py:552] Setting the env `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` to prevent memory overflow during save or load checkpoint file.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.460.971 [mindspore/ccsrc/pipeline/jit/ps/init.cc:527] operator()] Start releasing dataset handles...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.016 [mindspore/ccsrc/pipeline/jit/ps/init.cc:530] operator()] End release dataset handles.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.028 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2324] ClearResAtexit] Pipeline clear all resource
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.075 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:290] RecordExitStatus] Status record: system exit.
[INFO] DEBUG(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.099 [mindspore/ccsrc/common/debug/env_config_parser.cc:152] ParseFromFile] The 'env_config_path' in 'mindspore.context.set_context(env_config_path={path})' is empty.
[INFO] ME(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.149 [mindspore/core/mindrt/src/actor/actormgr.cc:153] Finalize] mindrt Actors finish exiting.
[INFO] ME(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.159 [mindspore/core/mindrt/src/actor/actormgr.cc:156] Finalize] mindrt Threads finish exiting.
[INFO] ME(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.170 [mindspore/core/mindrt/src/actor/actormgr.cc:167] Finalize] mindrt IOMGRS finish exiting.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.194 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2193] ClearResPart1] Start clear kernel runtime...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.211 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2195] ClearResPart1] End clear kernel runtime.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.223 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2198] ClearResPart1] Start Finalize StreamSynchronizer...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.239 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2200] ClearResPart1] End Finalize StreamSynchronizer...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.948 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:828] ClearRes] Clean executor resource!
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.461.967 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2214] ClearResPart2] Start clear PyNativeExecutor...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.037 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2216] ClearResPart2] End clear PyNativeExecutor.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.051 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2234] ClearResPart2] Start clear ConfigManager...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.064 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2236] ClearResPart2] End clear ConfigManager.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.078 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2247] ClearResPart2] Start clear device context...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.092 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2249] ClearResPart2] End clear device context.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.103 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2251] ClearResPart2] Start clear AnalysisResultCacheMgr...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.122 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2253] ClearResPart2] End clear AnalysisResultCacheMgr.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.134 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2255] ClearResPart2] Start clear AnalysisContext...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.148 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2257] ClearResPart2] End clear AnalysisContext...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.159 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2259] ClearResPart2] Start clear AnalysisSchedule...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.396 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2261] ClearResPart2] End clear AnalysisSchedule...
[INFO] DEBUG(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.423 [mindspore/ccsrc/debug/debugger/debugger.cc:101] Debugger] Debugger got device_target: GPU
[INFO] DEBUG(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.438 [mindspore/ccsrc/debug/debugger/debugger.cc:305] Reset] Release Debugger resource.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.465 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2274] ClearResPart3] Start clear ClearObjectCache...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.478 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2276] ClearResPart3] End clear ClearObjectCache...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.490 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2278] ClearResPart3] Start clear Parser...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.503 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2280] ClearResPart3] End clear Parser...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.514 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2282] ClearResPart3] Start ClearTraceStack...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.530 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2284] ClearResPart3] End ClearTraceStack...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.542 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2286] ClearResPart3] Start clear InterpretNodeRecorder...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.555 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2288] ClearResPart3] End clear InterpretNodeRecorder...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.567 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2290] ClearResPart3] Start clear parallel::entire_costgraph...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.580 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2292] ClearResPart3] End clear parallel::entire_costgraph...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.592 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2294] ClearResPart3] Start clear ProtobufLibrary...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.736 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2296] ClearResPart3] End clear ProtobufLibrary...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.749 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2298] ClearResPart3] Start clear python_adapter...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.763 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2300] ClearResPart3] End clear python_adapter.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.775 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2304] ClearSingleton] Start clear singleton...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.842 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2320] ClearSingleton] End clear singleton.
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.854 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2336] ClearResAtexit] Start unload dynamic lib...
[INFO] PIPELINE(611158,7f2b755a7740,python3):2024-03-11-09:59:29.462.874 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2338] ClearResAtexit] End unload dynamic lib...
$ cat test.log
2.2.11
按照正常来说,我们选择将程序运行的结果输出到log文件中,屏幕上是不应该有打印信息的。但是这里不仅仅有打印信息,而且在log文件中的输出只有我们打印的MindSpore版本号,并没有更多的提示信息,这并不是我们想要的。
在前面我们提到,Linux系统下程序运行的输出有分为正确输出和错误输出两种,分别用1和2两个数字来进行标记,所以上面那个案例的运行方法其实等同于:
$ python3 test_log.py 1> test.log
[INFO] ME(611613,7f9be0cb0740,python3):2024-03-11-10:03:19.387.589 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.2 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(611613,7f9be0cb0740,python3):2024-03-11-10:03:19.429.435 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.1 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(611613,7f9be0cb0740,python3):2024-03-11-10:03:19.471.471 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_gpu.so.11.6 failed. libnvrtc.so.11.2: cannot open shared object file: No such file or directory
[INFO] ME(611613,7f9be0cb0740,python3):2024-03-11-10:03:19.714.832 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:443] LoadPlugin] Load libmindspore_gpu plugin file /home/dechin/anaconda3/envs/mindsponge/lib/python3.9/site-packages/mindspore/lib/plugin/libmindspore_gpu.so.11.1 success, skip loading other version.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:19.744.044 [mindspore/ccsrc/pybind_api/ir/log_adapter_py.h:33] PyExceptionInitializer] Set exception handler
[ERROR] ME(611613:140307468060480,MainProcess):2024-03-11-10:03:19.782.914 [mindspore/run_check/_check_version.py:230] Cuda ['10.1', '11.1', '11.6'] version(libcudart*.so need by mindspore-gpu) is not found. Please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches. Please refer to the installation guidelines: https://www.mindspore.cn/install
[WARNING] ME(611613:140307468060480,MainProcess):2024-03-11-10:03:19.813.097 [mindspore/run_check/_check_version.py:98] Can not found cuda libs. Please confirm that the correct cuda version has been installed. Refer to the installation guidelines: https://www.mindspore.cn/install
[INFO] CORE(611613,7f9be0cb0740,python3):2024-03-11-10:03:19.836.465 [mindspore/core/utils/ms_context.cc:382] SetDeviceTargetFromInner] ms set context device target:GPU
[INFO] PARALLEL(611613,7f9be0cb0740,python3):2024-03-11-10:03:19.836.534 [mindspore/ccsrc/frontend/parallel/costmodel_context.cc:30] GetInstance] Create costmodel_context
[INFO] ME(611613:140307468060480,MainProcess):2024-03-11-10:03:19.836.746 [mindspore/run_check/_check_version.py:552] Setting the env `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` to prevent memory overflow during save or load checkpoint file.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.161 [mindspore/ccsrc/pipeline/jit/ps/init.cc:527] operator()] Start releasing dataset handles...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.207 [mindspore/ccsrc/pipeline/jit/ps/init.cc:530] operator()] End release dataset handles.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.219 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2324] ClearResAtexit] Pipeline clear all resource
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.255 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:290] RecordExitStatus] Status record: system exit.
[INFO] DEBUG(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.285 [mindspore/ccsrc/common/debug/env_config_parser.cc:152] ParseFromFile] The 'env_config_path' in 'mindspore.context.set_context(env_config_path={path})' is empty.
[INFO] ME(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.334 [mindspore/core/mindrt/src/actor/actormgr.cc:153] Finalize] mindrt Actors finish exiting.
[INFO] ME(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.344 [mindspore/core/mindrt/src/actor/actormgr.cc:156] Finalize] mindrt Threads finish exiting.
[INFO] ME(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.354 [mindspore/core/mindrt/src/actor/actormgr.cc:167] Finalize] mindrt IOMGRS finish exiting.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.372 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2193] ClearResPart1] Start clear kernel runtime...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.384 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2195] ClearResPart1] End clear kernel runtime.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.393 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2198] ClearResPart1] Start Finalize StreamSynchronizer...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.943.407 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2200] ClearResPart1] End Finalize StreamSynchronizer...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.008 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:828] ClearRes] Clean executor resource!
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.024 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2214] ClearResPart2] Start clear PyNativeExecutor...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.092 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2216] ClearResPart2] End clear PyNativeExecutor.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.104 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2234] ClearResPart2] Start clear ConfigManager...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.113 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2236] ClearResPart2] End clear ConfigManager.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.125 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2247] ClearResPart2] Start clear device context...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.137 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2249] ClearResPart2] End clear device context.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.146 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2251] ClearResPart2] Start clear AnalysisResultCacheMgr...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.159 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2253] ClearResPart2] End clear AnalysisResultCacheMgr.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.168 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2255] ClearResPart2] Start clear AnalysisContext...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.179 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2257] ClearResPart2] End clear AnalysisContext...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.188 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2259] ClearResPart2] Start clear AnalysisSchedule...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.429 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2261] ClearResPart2] End clear AnalysisSchedule...
[INFO] DEBUG(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.447 [mindspore/ccsrc/debug/debugger/debugger.cc:101] Debugger] Debugger got device_target: GPU
[INFO] DEBUG(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.466 [mindspore/ccsrc/debug/debugger/debugger.cc:305] Reset] Release Debugger resource.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.486 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2274] ClearResPart3] Start clear ClearObjectCache...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.496 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2276] ClearResPart3] End clear ClearObjectCache...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.505 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2278] ClearResPart3] Start clear Parser...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.516 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2280] ClearResPart3] End clear Parser...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.524 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2282] ClearResPart3] Start ClearTraceStack...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.538 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2284] ClearResPart3] End ClearTraceStack...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.546 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2286] ClearResPart3] Start clear InterpretNodeRecorder...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.557 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2288] ClearResPart3] End clear InterpretNodeRecorder...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.566 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2290] ClearResPart3] Start clear parallel::entire_costgraph...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.577 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2292] ClearResPart3] End clear parallel::entire_costgraph...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.586 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2294] ClearResPart3] Start clear ProtobufLibrary...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.727 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2296] ClearResPart3] End clear ProtobufLibrary...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.738 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2298] ClearResPart3] Start clear python_adapter...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.747 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2300] ClearResPart3] End clear python_adapter.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.757 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2304] ClearSingleton] Start clear singleton...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.832 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2320] ClearSingleton] End clear singleton.
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.841 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2336] ClearResAtexit] Start unload dynamic lib...
[INFO] PIPELINE(611613,7f9be0cb0740,python3):2024-03-11-10:03:20.944.857 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2338] ClearResAtexit] End unload dynamic lib...
$ cat test.log
2.2.11
加上一个1之后运行的结果也是一样的。这里1表示正确的输出结果,在这个案例中正确输出结果就是我们所打印的版本号信息。而2表示的是一个错误输出结果,1和2默认都是把输出结果指向到屏幕输出,可以看到第一次案例运行的时候,屏幕上既输出了版本号,也输出了提示信息。但是当我们把1指向一个文件的时候,屏幕上只剩下提示信息,而正确输出信息被保存到了log文件里面。因为MindSpore框架下所有的提示信息都被Linux归类为错误输出信息,因此如果我们需要在文件中保存这些提示信息的话,我们就需要手动的把2也指向到一个输出文件里面。更加常规的方法,我们会把1指向到一个输出文件,然后再把2指向到1,这样就可以在同一个文件中输出所有我们想要的信息:
$ python3 test_log.py 1> test.log 2>&1
$ cat test.log
[INFO] ME(612039,7fcea118a740,python3):2024-03-11-10:12:07.807.272 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.2 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(612039,7fcea118a740,python3):2024-03-11-10:12:07.849.950 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.1 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(612039,7fcea118a740,python3):2024-03-11-10:12:07.893.162 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_gpu.so.11.6 failed. libnvrtc.so.11.2: cannot open shared object file: No such file or directory
[INFO] ME(612039,7fcea118a740,python3):2024-03-11-10:12:08.137.391 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:443] LoadPlugin] Load libmindspore_gpu plugin file /home/dechin/anaconda3/envs/mindsponge/lib/python3.9/site-packages/mindspore/lib/plugin/libmindspore_gpu.so.11.1 success, skip loading other version.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:08.166.883 [mindspore/ccsrc/pybind_api/ir/log_adapter_py.h:33] PyExceptionInitializer] Set exception handler
[ERROR] ME(612039:140525442737984,MainProcess):2024-03-11-10:12:08.206.668 [mindspore/run_check/_check_version.py:230] Cuda ['10.1', '11.1', '11.6'] version(libcudart*.so need by mindspore-gpu) is not found. Please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches. Please refer to the installation guidelines: https://www.mindspore.cn/install
[WARNING] ME(612039:140525442737984,MainProcess):2024-03-11-10:12:08.240.998 [mindspore/run_check/_check_version.py:98] Can not found cuda libs. Please confirm that the correct cuda version has been installed. Refer to the installation guidelines: https://www.mindspore.cn/install
[INFO] CORE(612039,7fcea118a740,python3):2024-03-11-10:12:08.266.562 [mindspore/core/utils/ms_context.cc:382] SetDeviceTargetFromInner] ms set context device target:GPU
[INFO] PARALLEL(612039,7fcea118a740,python3):2024-03-11-10:12:08.266.649 [mindspore/ccsrc/frontend/parallel/costmodel_context.cc:30] GetInstance] Create costmodel_context
[INFO] ME(612039:140525442737984,MainProcess):2024-03-11-10:12:08.266.881 [mindspore/run_check/_check_version.py:552] Setting the env `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` to prevent memory overflow during save or load checkpoint file.
2.2.11
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.065 [mindspore/ccsrc/pipeline/jit/ps/init.cc:527] operator()] Start releasing dataset handles...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.127 [mindspore/ccsrc/pipeline/jit/ps/init.cc:530] operator()] End release dataset handles.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.149 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2324] ClearResAtexit] Pipeline clear all resource
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.227 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:290] RecordExitStatus] Status record: system exit.
[INFO] DEBUG(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.271 [mindspore/ccsrc/common/debug/env_config_parser.cc:152] ParseFromFile] The 'env_config_path' in 'mindspore.context.set_context(env_config_path={path})' is empty.
[INFO] ME(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.336 [mindspore/core/mindrt/src/actor/actormgr.cc:153] Finalize] mindrt Actors finish exiting.
[INFO] ME(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.347 [mindspore/core/mindrt/src/actor/actormgr.cc:156] Finalize] mindrt Threads finish exiting.
[INFO] ME(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.357 [mindspore/core/mindrt/src/actor/actormgr.cc:167] Finalize] mindrt IOMGRS finish exiting.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.394 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2193] ClearResPart1] Start clear kernel runtime...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.429 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2195] ClearResPart1] End clear kernel runtime.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.438 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2198] ClearResPart1] Start Finalize StreamSynchronizer...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.397.456 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2200] ClearResPart1] End Finalize StreamSynchronizer...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.282 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:828] ClearRes] Clean executor resource!
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.314 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2214] ClearResPart2] Start clear PyNativeExecutor...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.418 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2216] ClearResPart2] End clear PyNativeExecutor.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.431 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2234] ClearResPart2] Start clear ConfigManager...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.439 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2236] ClearResPart2] End clear ConfigManager.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.457 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2247] ClearResPart2] Start clear device context...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.468 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2249] ClearResPart2] End clear device context.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.477 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2251] ClearResPart2] Start clear AnalysisResultCacheMgr...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.495 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2253] ClearResPart2] End clear AnalysisResultCacheMgr.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.505 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2255] ClearResPart2] Start clear AnalysisContext...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.523 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2257] ClearResPart2] End clear AnalysisContext...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.531 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2259] ClearResPart2] Start clear AnalysisSchedule...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.881 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2261] ClearResPart2] End clear AnalysisSchedule...
[INFO] DEBUG(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.925 [mindspore/ccsrc/debug/debugger/debugger.cc:101] Debugger] Debugger got device_target: GPU
[INFO] DEBUG(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.939 [mindspore/ccsrc/debug/debugger/debugger.cc:305] Reset] Release Debugger resource.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.958 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2274] ClearResPart3] Start clear ClearObjectCache...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.968 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2276] ClearResPart3] End clear ClearObjectCache...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.976 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2278] ClearResPart3] Start clear Parser...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.398.989 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2280] ClearResPart3] End clear Parser...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.006 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2282] ClearResPart3] Start ClearTraceStack...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.032 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2284] ClearResPart3] End ClearTraceStack...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.048 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2286] ClearResPart3] Start clear InterpretNodeRecorder...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.059 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2288] ClearResPart3] End clear InterpretNodeRecorder...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.067 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2290] ClearResPart3] Start clear parallel::entire_costgraph...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.084 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2292] ClearResPart3] End clear parallel::entire_costgraph...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.093 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2294] ClearResPart3] Start clear ProtobufLibrary...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.306 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2296] ClearResPart3] End clear ProtobufLibrary...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.321 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2298] ClearResPart3] Start clear python_adapter...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.333 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2300] ClearResPart3] End clear python_adapter.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.350 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2304] ClearSingleton] Start clear singleton...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.561 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2320] ClearSingleton] End clear singleton.
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.574 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2336] ClearResAtexit] Start unload dynamic lib...
[INFO] PIPELINE(612039,7fcea118a740,python3):2024-03-11-10:12:09.399.620 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2338] ClearResAtexit] End unload dynamic lib...
可以看到,这里我们执行第一条指令的时候,屏幕上是没有任何输出的,而在log文件中可以看到所有的正确输出和提示信息,这也是我们的目标。
简化指令
上面用到的把所有信息都输出到同一个文件里面的操作,其实有一个更加简单的写法:
$ python3 test_log.py &> test.log
$ cat test.log
[INFO] ME(612357,7fc40f5ac740,python3):2024-03-11-10:15:46.386.904 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.2 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(612357,7fc40f5ac740,python3):2024-03-11-10:15:46.429.319 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_ascend.so.1 failed. libge_runner.so: cannot open shared object file: No such file or directory
[INFO] ME(612357,7fc40f5ac740,python3):2024-03-11-10:15:46.471.885 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:264] LoadDynamicLib] Load dynamic library: libmindspore_gpu.so.11.6 failed. libnvrtc.so.11.2: cannot open shared object file: No such file or directory
[INFO] ME(612357,7fc40f5ac740,python3):2024-03-11-10:15:46.711.098 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:443] LoadPlugin] Load libmindspore_gpu plugin file /home/dechin/anaconda3/envs/mindsponge/lib/python3.9/site-packages/mindspore/lib/plugin/libmindspore_gpu.so.11.1 success, skip loading other version.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:46.739.590 [mindspore/ccsrc/pybind_api/ir/log_adapter_py.h:33] PyExceptionInitializer] Set exception handler
[ERROR] ME(612357:140480047925056,MainProcess):2024-03-11-10:15:46.779.766 [mindspore/run_check/_check_version.py:230] Cuda ['10.1', '11.1', '11.6'] version(libcudart*.so need by mindspore-gpu) is not found. Please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches. Please refer to the installation guidelines: https://www.mindspore.cn/install
[WARNING] ME(612357:140480047925056,MainProcess):2024-03-11-10:15:46.809.942 [mindspore/run_check/_check_version.py:98] Can not found cuda libs. Please confirm that the correct cuda version has been installed. Refer to the installation guidelines: https://www.mindspore.cn/install
[INFO] CORE(612357,7fc40f5ac740,python3):2024-03-11-10:15:46.832.407 [mindspore/core/utils/ms_context.cc:382] SetDeviceTargetFromInner] ms set context device target:GPU
[INFO] PARALLEL(612357,7fc40f5ac740,python3):2024-03-11-10:15:46.832.483 [mindspore/ccsrc/frontend/parallel/costmodel_context.cc:30] GetInstance] Create costmodel_context
[INFO] ME(612357:140480047925056,MainProcess):2024-03-11-10:15:46.832.705 [mindspore/run_check/_check_version.py:552] Setting the env `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` to prevent memory overflow during save or load checkpoint file.
2.2.11
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.393 [mindspore/ccsrc/pipeline/jit/ps/init.cc:527] operator()] Start releasing dataset handles...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.437 [mindspore/ccsrc/pipeline/jit/ps/init.cc:530] operator()] End release dataset handles.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.450 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2324] ClearResAtexit] Pipeline clear all resource
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.483 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:290] RecordExitStatus] Status record: system exit.
[INFO] DEBUG(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.508 [mindspore/ccsrc/common/debug/env_config_parser.cc:152] ParseFromFile] The 'env_config_path' in 'mindspore.context.set_context(env_config_path={path})' is empty.
[INFO] ME(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.557 [mindspore/core/mindrt/src/actor/actormgr.cc:153] Finalize] mindrt Actors finish exiting.
[INFO] ME(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.569 [mindspore/core/mindrt/src/actor/actormgr.cc:156] Finalize] mindrt Threads finish exiting.
[INFO] ME(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.578 [mindspore/core/mindrt/src/actor/actormgr.cc:167] Finalize] mindrt IOMGRS finish exiting.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.593 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2193] ClearResPart1] Start clear kernel runtime...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.618 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2195] ClearResPart1] End clear kernel runtime.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.627 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2198] ClearResPart1] Start Finalize StreamSynchronizer...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.946.639 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2200] ClearResPart1] End Finalize StreamSynchronizer...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.247 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:828] ClearRes] Clean executor resource!
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.266 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2214] ClearResPart2] Start clear PyNativeExecutor...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.334 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2216] ClearResPart2] End clear PyNativeExecutor.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.345 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2234] ClearResPart2] Start clear ConfigManager...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.354 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2236] ClearResPart2] End clear ConfigManager.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.365 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2247] ClearResPart2] Start clear device context...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.376 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2249] ClearResPart2] End clear device context.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.386 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2251] ClearResPart2] Start clear AnalysisResultCacheMgr...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.397 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2253] ClearResPart2] End clear AnalysisResultCacheMgr.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.405 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2255] ClearResPart2] Start clear AnalysisContext...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.416 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2257] ClearResPart2] End clear AnalysisContext...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.424 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2259] ClearResPart2] Start clear AnalysisSchedule...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.736 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2261] ClearResPart2] End clear AnalysisSchedule...
[INFO] DEBUG(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.759 [mindspore/ccsrc/debug/debugger/debugger.cc:101] Debugger] Debugger got device_target: GPU
[INFO] DEBUG(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.771 [mindspore/ccsrc/debug/debugger/debugger.cc:305] Reset] Release Debugger resource.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.790 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2274] ClearResPart3] Start clear ClearObjectCache...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.799 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2276] ClearResPart3] End clear ClearObjectCache...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.807 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2278] ClearResPart3] Start clear Parser...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.817 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2280] ClearResPart3] End clear Parser...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.825 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2282] ClearResPart3] Start ClearTraceStack...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.838 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2284] ClearResPart3] End ClearTraceStack...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.854 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2286] ClearResPart3] Start clear InterpretNodeRecorder...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.866 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2288] ClearResPart3] End clear InterpretNodeRecorder...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.875 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2290] ClearResPart3] Start clear parallel::entire_costgraph...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.884 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2292] ClearResPart3] End clear parallel::entire_costgraph...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.947.893 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2294] ClearResPart3] Start clear ProtobufLibrary...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.948.020 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2296] ClearResPart3] End clear ProtobufLibrary...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.948.033 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2298] ClearResPart3] Start clear python_adapter...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.948.042 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2300] ClearResPart3] End clear python_adapter.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.948.051 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2304] ClearSingleton] Start clear singleton...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.948.115 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2320] ClearSingleton] End clear singleton.
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.948.126 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2336] ClearResAtexit] Start unload dynamic lib...
[INFO] PIPELINE(612357,7fc40f5ac740,python3):2024-03-11-10:15:47.948.161 [mindspore/ccsrc/pipeline/jit/ps/pipeline.cc:2338] ClearResAtexit] End unload dynamic lib...
效果是一致的。如果我们不想看到那么多的提示信息,可以把log等级设置的高一点:export GLOG_v=3,最高可以达到4,这样输出的内容会简洁很多:
$ python3 test_log.py &> test.log
$ cat test.log
[ERROR] ME(612734:139952602597184,MainProcess):2024-03-11-10:17:23.526.387 [mindspore/run_check/_check_version.py:230] Cuda ['10.1', '11.1', '11.6'] version(libcudart*.so need by mindspore-gpu) is not found. Please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches. Please refer to the installation guidelines: https://www.mindspore.cn/install
2.2.11
再就是,如果我们在远程链接中去启动一个执行任务的时候,如果任务持续时间较长,而窗口留存时间又有限(通常会限定半个小时的在线时间)。此时我们可以使用“挂起”的方法在后台去运行程序:
$ python3 test_log.py &> test.log &
[1] 613179
$ ps -p 613179 -o etime
[1]+ 已完成 python3 test_log.py &> test.log
ELAPSED
$ cat test.log
[ERROR] ME(613179:140470618052416,MainProcess):2024-03-11-10:21:08.406.711 [mindspore/run_check/_check_version.py:230] Cuda ['10.1', '11.1', '11.6'] version(libcudart*.so need by mindspore-gpu) is not found. Please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches. Please refer to the installation guidelines: https://www.mindspore.cn/install
The MindSpore version is: 2.2.11
这样的程序运行方法,可以避免因为窗口交互而中断了任务的运行,这其实也是我们需要把程序的运行结果输出到一个指定文件内的原因,方便我们随时可以查看任务的进展,而又不会收到窗口交互的影响。
总结概要
在Linux运行程序时,正确输出和错误输出会分成两条路线分别输出到不同的位置,默认输出是将两者按照顺序分别输出到屏幕上,而我们也可以通过设定将二者按照顺序输出到一个指定的log文件中。同时为了避免受到窗口交互的影响,我们可以使用Linux挂起的方式来运行一个程序,这样我们既不用担心任务被中断,也可以同时不断的通过log文件内容来查看任务的运行情况,还可以通过ps指令来查看任务进程运行的时长等信息。
版权声明
本文首发链接为:https://www.cnblogs.com/dechinphy/p/ouput-to-log.html
作者ID:DechinPhy
更多原著文章:https://www.cnblogs.com/dechinphy/
请博主喝咖啡:https://www.cnblogs.com/dechinphy/gallery/image/379634.html
参考链接
将MindSpore运行结果输出到log文件的更多相关文章
- Net Core 控制台程序使用Nlog 输出到log文件
using CoreImportDataApp.Common; using Microsoft.Extensions.Configuration; using Microsoft.Extensions ...
- Shell脚本 | 抓取log文件
在安卓应用的测试过程中,遇到 Crash 或者 ANR 后,想必大家都会通过 adb logcat 命令来抓取日志定位问题.如果直接使用 logcat 命令的话,默认抓取出的 log 文件包含安卓运行 ...
- linux 执行shell脚本的时候,生成的log文件乱码
脚本执行后,生成的log文件,cat打开没有问题,vim打开就是文字乱码. file1完全没有问题,其他人的file2追加到file中间的时候就出现了这个问题. 因为使用notepad在win7写的, ...
- 使用idea插件识别log文件的相关设置
最近要读一些spring boot项目产生的log文件,众所周知,idea拥有强大的插件系统.当我打开log文件时,idea自动帮我推荐了ideolog这个插件. 但是当我安装好之后发现系统并不能完全 ...
- 记录终端输出的LOG到文件
先要说明为什么要记录终端会话,因为常会遇到这样的情况,终端是有缓存大小限制的,当在终端打印的消息超出缓存范围,它前面的打印消息就自动丢失了,这对于我们调试程序会造成障碍,所以有记录完整终端打印消息的必 ...
- Linux(9)后台运行python程序并输出到日志文件
后台运行python程序并标准输出到文件 现在有test.py程序要后台部署, 里面有输出内容 使用命令: nohup python -u test.py > test.log 2>&am ...
- Linux后台运行python程序并输出到日志文件
后台运行python程序并标准输出到文件 现在有test.py程序要后台部署, 里面有输出内容 使用命令: nohup python -u test.py > test.log 2>&am ...
- Linux命令nohup实现命令后台运行并输出到或记录到日志文件
Linux命令nohup实现命令后台运行并输出到或记录到日志文件 导读 我们在调试程序的时候,免不了要去抓一些 log ,然后进行分析.如果 log 量不是很大的话,那很简单,只需简单的复制粘贴就好. ...
- android源码环境下用mmm/mm编译模块,输出编译log到文件的方法
android源码环境下用mmm/mm编译模块,输出编译log到文件的方法 1,在android目录下直接用mmm命令编译, log信息保存在android目录下 mmm packages/apps/ ...
- log4j.properties配置与将异常输出到Log日志文件实例
将异常输出到 log日志文件 实际项目中的使用: <dependencies> <dependency> <groupId>org.slf4j</groupI ...
随机推荐
- Unity字体和画面花屏处理
字体花屏和相机渲染花屏,这两者的表现有明显的差异. 字体花屏 字体花屏是持续性的,直到组件被刷新,或字体图集被刷新.目前在我们项目中当游戏启动时,就会填充游戏用到的所有字符到贴图中,所以并没有遇到此问 ...
- PaddleNLP--UIE(二)--小样本快速提升性能(含doccona标注)
相关文章: 1.快递单中抽取关键信息[一]----基于BiGRU+CR+预训练的词向量优化 2.快递单信息抽取[二]基于ERNIE1.0至ErnieGram + CRF预训练模型 3.快递单信息抽取[ ...
- BoostAsyncSocket 异步反弹通信案例
Boost 利用ASIO框架实现一个跨平台的反向远控程序,该远控支持保存套接字,当有套接字连入时,自动存储到map容器,当客户下线时自动从map容器中移除,当我们需要与特定客户端通信时,只需要指定客户 ...
- 关于TypeScript中提示xxx is declared but its value is never read的解决方法
首先,提示很明显,是定义了变量,但是却没有使用.解决方案有如下两种: 一: 需要确定变量是否真的没有使用到,如果没有使用直接删除即可. 二: 对于方法中的入参,是没法随便删除的.这时候我们可以利用Ty ...
- mermaid图详解(一)流程图|超详细的代码解释
本文参考Github项目 https://github.com/mermaid-js/mermaid/ 前言 那么这里博主先安利一些干货满满的专栏了! 首先是博主的高质量博客的汇总,这个专栏里面的博客 ...
- FastGateway 一个可以用于代替Nginx的网关
在我本人研究Yarp的时候经常用于公司项目的业务网关代理,这时候就个大佬问我是否可以实现动态加载HTTPS证书?那时候我说不太可能实现,然而在某一天我看到 微软使用Yarp代替了Nginx吞吐量提升了 ...
- MarkDown书写语法(常用格式)
实际上每个 Markdown 应用程序都实现了稍有不同的 Markdown 语法,熟悉MarkDown书写语法常用格式,满足日常文字编辑需求 1.标题 请在单词或短语前面添加井号 (#) .# 的数量 ...
- webrtc终极版(题外话)辛苦写文章分享,竟然遇到喷子狂喷,写篇文章回怼下,顺便发表下面对喷子的处理方式
webrtc终极版(题外话)辛苦写文章分享,竟然遇到喷子狂喷,写篇文章回怼下,顺便发表下面对喷子的处理方式 第一篇文章发过后,出人意料的是,收到了博客园某一位用户的狂喷[注:本系列文章会同步发布到cs ...
- HBase-HBase的特征、优缺点、应用场景
一.Hbase的概念 HBase是Hadoop的生态系统,是建立在Hadoop文件系统(HDFS)之上的分布式.面向列的数据库,通过利用Hadoop的文件系统提供容错能力.如果你需要进行实时读写或者随 ...
- C++——编译和链接原理笔记
我们在学习和开发C++程序中,理解编译和链接的原理至关重要.下面将学习一下C++程序是如何从源代码转换为可执行文件的过程,并结合示例代码进行说明.也是为了解开自己在刚学习C++的时候,编译时间长的疑惑 ...