技术背景

我们在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系统下程序运行的输出有分为正确输出和错误输出两种,分别用12两个数字来进行标记,所以上面那个案例的运行方法其实等同于:

$ 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表示的是一个错误输出结果,12默认都是把输出结果指向到屏幕输出,可以看到第一次案例运行的时候,屏幕上既输出了版本号,也输出了提示信息。但是当我们把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

参考链接

  1. https://blog.csdn.net/zhaominpro/article/details/82630528

将MindSpore运行结果输出到log文件的更多相关文章

  1. Net Core 控制台程序使用Nlog 输出到log文件

    using CoreImportDataApp.Common; using Microsoft.Extensions.Configuration; using Microsoft.Extensions ...

  2. Shell脚本 | 抓取log文件

    在安卓应用的测试过程中,遇到 Crash 或者 ANR 后,想必大家都会通过 adb logcat 命令来抓取日志定位问题.如果直接使用 logcat 命令的话,默认抓取出的 log 文件包含安卓运行 ...

  3. linux 执行shell脚本的时候,生成的log文件乱码

    脚本执行后,生成的log文件,cat打开没有问题,vim打开就是文字乱码. file1完全没有问题,其他人的file2追加到file中间的时候就出现了这个问题. 因为使用notepad在win7写的, ...

  4. 使用idea插件识别log文件的相关设置

    最近要读一些spring boot项目产生的log文件,众所周知,idea拥有强大的插件系统.当我打开log文件时,idea自动帮我推荐了ideolog这个插件. 但是当我安装好之后发现系统并不能完全 ...

  5. 记录终端输出的LOG到文件

    先要说明为什么要记录终端会话,因为常会遇到这样的情况,终端是有缓存大小限制的,当在终端打印的消息超出缓存范围,它前面的打印消息就自动丢失了,这对于我们调试程序会造成障碍,所以有记录完整终端打印消息的必 ...

  6. Linux(9)后台运行python程序并输出到日志文件

    后台运行python程序并标准输出到文件 现在有test.py程序要后台部署, 里面有输出内容 使用命令: nohup python -u test.py > test.log 2>&am ...

  7. Linux后台运行python程序并输出到日志文件

    后台运行python程序并标准输出到文件 现在有test.py程序要后台部署, 里面有输出内容 使用命令: nohup python -u test.py > test.log 2>&am ...

  8. Linux命令nohup实现命令后台运行并输出到或记录到日志文件

    Linux命令nohup实现命令后台运行并输出到或记录到日志文件 导读 我们在调试程序的时候,免不了要去抓一些 log ,然后进行分析.如果 log 量不是很大的话,那很简单,只需简单的复制粘贴就好. ...

  9. android源码环境下用mmm/mm编译模块,输出编译log到文件的方法

    android源码环境下用mmm/mm编译模块,输出编译log到文件的方法 1,在android目录下直接用mmm命令编译, log信息保存在android目录下 mmm packages/apps/ ...

  10. log4j.properties配置与将异常输出到Log日志文件实例

    将异常输出到 log日志文件 实际项目中的使用: <dependencies> <dependency> <groupId>org.slf4j</groupI ...

随机推荐

  1. go中channel源码剖析

    channel 前言 设计的原理 共享内存 csp channel channel的定义 源码剖析 环形队列 创建 写入数据 读取数据 channel的关闭 优雅的关闭 M个receivers,一个s ...

  2. app api 登录 流程 accessToken refreshToken 图解 过程分析

    随着app 增长 带动了 api 的增长,有了api 总是离不开登录,怎么实现简单安全的登录过程至关重要. 不让用户每次超时都输入密码,不在客户端保存账号密码 ,用户体验与安全至关重要. 没有绝对的安 ...

  3. spring boot jar混淆加密

    最近在做一个智能床垫的机构版项目,客户要求部署到客户那边要做代码混淆防止代码被反编译. 一:在需要加密的jar的pom.xml文件添加依赖 <!-- 设置 jitpack.io 仓库 --> ...

  4. .NET中使用BootstrapBlazor组件库Table实操篇

    前言 Table表格在后台管理应用中使用的是相当频繁的,因此找一个功能齐全的前端框架对于我们而言是非常必要的,因为封装完善的前端框架能够大大提升我们的工作对接效率.今天我们主要来讲解一下在.NET中使 ...

  5. yapi 启动后,老是自动关闭的问题。

    解决方法只需要2步: 1.在命令后面加 & 符号,放到后台执行,最终的命令为: node /usr/local/yapi/yapi/vendors/server/app.js & 2. ...

  6. [Java][Spring]spring profile与maven profile多环境管理

    spring profile 与 maven profile 多环境管理 spring profile Spring profile是Spring提供的多环境管理方案. 如下图: 每种环境都对应一个y ...

  7. NC20568 [SCOI2012]滑雪与时间胶囊

    题目链接 题目 题目描述 a180285非常喜欢滑雪.他来到一座雪山,这里分布着M条供滑行的轨道和N个轨道之间的交点(同时也是景点),而且每个景点都有一编号i(1 ≤ i ≤ N)和一高度Hi.a18 ...

  8. Office Online Server Windows Server 2016 部署

    一.准备"武器" 本文是通过虚拟机搭建 OOS 测试环境的,4567是3的前提,武器提取 le73 1.VMWare Workstation 17 Player 2.Windows ...

  9. Python中矩阵运算(基于numpy包)

    1 乘法 在数组中,a * a计算对应元素相乘(矩阵点乘):在矩阵中,A*A计算矩阵乘法 np.multiply()计算对应元素相乘(矩阵点乘) np.dot()计算矩阵乘法 import numpy ...

  10. ex命令

    ex命令 ex命令用于在Ex模式下启动vim文本编辑器,ex执行效果如同vi -e,如要从Ex模式回到普通模式,则在vim中输入:vi或:visual指令即可,可以通过运行vi -e来启动ex,也可以 ...