update docs about save log

This commit is contained in:
hengyunabc
2022-09-13 15:58:26 +08:00
parent 3b38957dea
commit 0dbb10a7b0
8 changed files with 43 additions and 69 deletions
+11 -4
View File
@@ -57,17 +57,24 @@ $ jobs
$ trace Test t >> test.out &
```
这时 trace 命令会在后台执行,并且把结果输出到~/logs/arthas-cache/test.out。可继续执行其他命令。并可查看文件中的命令执行结果。
这时 trace 命令会在后台执行,并且把结果输出到应用`工作目录`下面的`test.out`文件。可继续执行其他命令。并可查看文件中的命令执行结果。可以执行`pwd`命令查看当前应用的`工作目录`
当连接到远程的 arthas server 时,可能无法查看远程机器的文件,arthas 同时支持了自动重定向到本地缓存路径。使用方法如下:
```bash
$ cat test.out
```
如果没有指定重定向文件,则会把结果输出到`~/logs/arthas-cache/`目录下,比如:
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/gehui/logs/arthas-cache/28198/2
cache location : /Users/admin/logs/arthas-cache/28198/2
```
可以看到并没有指定重定向文件位置,arthas 自动重定向到缓存中了,执行命令后会输出 job id 和 cache location。cache location 就是重定向文件的路径,在系统 logs 目录下,路径包括 pid 和 job id,避免和其他任务冲突。命令输出结果到`/Users/gehui/logs/arthas-cache/28198/2`中,job id 为 2。
此时命令会在后台异步执行,并将结果异步保存在文件(`~/logs/arthas-cache/${PID}/${JobId}`)中;
- 此时任务的执行不受 session 断开的影响;任务默认超时时间是 1 天,可以通过全局 `options` 命令修改默认超时时间;
- 此命令的结果将异步输出到  文件中;此时不管 `save-result` 是否为 true,都不会再往`~/logs/arthas-cache/result.log` 中异步写结果。
## 6. 停止命令
+2 -11
View File
@@ -22,15 +22,6 @@ Affect(row-cnt:1) cost in 3 ms.
结果会异步保存在:`{user.home}/logs/arthas-cache/result.log`,请定期进行清理,以免占据磁盘空间
## 使用新版本 Arthas 的异步后台任务将结果存日志文件
## 使用 Arthas 的异步后台任务将结果存日志文件
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/admin/logs/arthas-cache/28198/2
```
此时命令会在后台异步执行,并将结果异步保存在文件(~/logs/arthas-cache/${PID}/${JobId})中;
- 此时任务的执行不受 session 断开的影响;任务默认超时时间是 1 天,可以通过全局 `options` 命令修改默认超时时间;
- 此命令的结果将异步输出到  文件中;此时不管 `save-result` 是否为 true,都不会再往~/logs/arthas-cache/result.log 中异步写结果
参考:[async](async.md)
+14 -7
View File
@@ -57,17 +57,24 @@ The job output can be redirect to the specified file by `>` or `>>`, and can be
$ trace Test t >> test.out &
```
The trace command will be running in the background and the output will be redirect to `~/logs/arthas-cache/test.out`. You can continue to execute other commands in the console, at the same time, you can also examine the execution result from the output file.
When connected to a remote Arthas server, you may not be able to view the output file on the remote machine. In this case, Arthas also supports automatically redirecting the output to the local cache file. Examples are as follows:
At this time, the trace command will be executed in the background, and the result will be output to the `test.out` file under the `working directory` of the application. You can continue to execute other commands. And you can view the command execution result in the file. You can execute the `pwd` command to view the `working directory` of the current application.
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/gehui/logs/arthas-cache/28198/2
$ cat test.out
```
If output path is not given, Arthas will automatically redirect the output to the local cache. Job id and cache location will be shown on the console. Cache location is a directory where the output files are put. For one given job, the path of its output file contains PID and job id in order to avoid potential conflict with other jobs. In the above example, pid is `28198` and job id is `2`.
If no redirect file is specified, the result will be output to the `~/logs/arthas-cache/` directory, for example:
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/admin/logs/arthas-cache/28198/2
```
At this time, the command will be executed asynchronously in the background, and the result will be asynchronously saved in the file (`~/logs/arthas-cache/${PID}/${JobId}`);
- At this time, the execution of the task is not affected by the session disconnection; the default timeout period of the task is 1 day, and the default timeout period can be modified through the global `options` command;
- The result of this command will be output asynchronously to the file; at this time, regardless of whether `save-result` is true or not, the result will not be written asynchronously to `~/logs/arthas-cache/result.log`.
## 6. Stop job
+1 -10
View File
@@ -24,13 +24,4 @@ Log command outputs for later analysis
## Use asynchronous job to log
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/zhuyong/logs/arthas-cache/28198/2
```
By doing this, the command will run at background asynchronously, and output the execution result into `~/logs/arthas-cache/{PID}/{JobId}`:
- The background job will continue to run even if the current session is disconnected. The default job timeout value is 1 day, use global '[options](options.md)' command to alternate it.
- The execution result will be output into the file asynchronously. Pls. note the behavior of this command is not controlled by `save-result` option from global [options](options.md). No matter `save-result` is set to `true` or not, this command will write into `~/logs/arthas-cache/{PID}/{JobId}` anyway, instead of into `~/logs/arthas-cache/result.log`.
Reference: [async] (async.md)
@@ -3,18 +3,9 @@
`trace demo.MathGame primeFactors >> test.out &`{{execute T2}}
这时trace命令会在后台执行,并且把结果输出到`~/logs/arthas-cache/test.out`。可继续执行其他命令。并可查看文件中的命令执行结果。
这时 trace 命令会在后台执行,并且把结果输出到应用`工作目录`下面的`test.out`文件。可继续执行其他命令。并可查看文件中的命令执行结果。可以执行`pwd`命令查看当前应用的`工作目录`
`pwd`{{execute T2}}
`cat test.out`{{execute T2}}
当连接到远程的arthas server时,可能无法查看远程机器的文件,arthas同时支持了自动重定向到本地缓存路径。使用方法如下:
`trace demo.MathGame primeFactors >> &`{{execute T2}}
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/gehui/logs/arthas-cache/28198/2
```
可以看到并没有指定重定向文件位置,arthas自动重定向到缓存中了,执行命令后会输出`job id``cache location``cache location`就是重定向文件的路径,在系统logs目录下,路径包括`pid``job id`,避免和其他任务冲突。命令输出结果到`/Users/gehui/logs/arthas-cache/28198/2`中,`job id`为2。
@@ -3,18 +3,9 @@ The job output can be redirect to the specified file by > or >>, and can be used
`trace demo.MathGame primeFactors >> test.out &`{{execute T2}}
The trace command will be running in the background and the output will be redirect to `~/logs/arthas-cache/test.out`. You can continue to execute other commands in the console, at the same time, you can also examine the execution result from the output file.
At this time, the trace command will be executed in the background, and the result will be output to the `test.out` file under the `working directory` of the application. You can continue to execute other commands. And you can view the command execution result in the file. You can execute the `pwd` command to view the `working directory` of the current application.
`pwd`{{execute T2}}
`cat test.out`{{execute T2}}
When connected to a remote Arthas server, you may not be able to view the output file on the remote machine. In this case, Arthas also supports automatically redirecting the output to the local cache file. Examples are as follows:
`trace demo.MathGame primeFactors >> &`{{execute T2}}
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/gehui/logs/arthas-cache/28198/2
```
If output path is not given, Arthas will automatically redirect the output to the local cache. `Job id` and `cache location` will be shown on the console. `Cache location` is a directory where the output files are put. For one given job, the path of its output file contains `PID` and `job id` in order to avoid potential conflict with other jobs. In the above example, `pid` is 28198 and `job id` is 2.
@@ -20,7 +20,7 @@ Affect(row-cnt:1) cost in 3 ms.
结果会异步保存在:`{user.home}/logs/arthas-cache/result.log`,请定期进行清理,以免占据磁盘空间
## 使用新版本Arthas的异步后台任务将结果存日志文件
## 使用Arthas的异步后台任务将结果存日志文件
```bash
$ trace Test t >> &
@@ -28,9 +28,5 @@ job id : 2
cache location : /Users/admin/logs/arthas-cache/28198/2
```
此时命令会在后台异步执行,并将结果异步保存在文件(~/logs/arthas-cache/${PID}/${JobId})中;
- 此时任务的执行不受session断开的影响;任务默认超时时间是1天,可以通过全局 `options` 命令修改默认超时时间;
- 此命令的结果将异步输出到文件中;此时不管 `save-result` 是否为true,都不会再往~/logs/arthas-cache/result.log 中异步写结果
* 参考: https://arthas.aliyun.com/doc/async.html
@@ -16,16 +16,16 @@ Affect(row-cnt:1) cost in 3 ms.
If the message above is output on the console, then this behavior is enabled successfully.
## Log file path
* Log file path
The command execution result will be save in `{user.home}/logs/arthas-cache/result.log` Pls. clean it up regularly to save disk space.
Use asynchronous job to log
## Use asynchronous job to log
```bash
$ trace Test t >> &
job id : 2
cache location : /Users/zhuyong/logs/arthas-cache/28198/2
By doing this, the command will run at background asynchronously, and output the execution result into `~/logs/arthas-cache/{PID}/{JobId}`:
cache location : /Users/admin/logs/arthas-cache/28198/2
```
The background job will continue to run even if the current session is disconnected. The default job timeout value is 1 day, use global [options](https://arthas.aliyun.com/doc/en/options.html) command to alternate it.
The execution result will be output into the file asynchronously. Pls. note the behavior of this command is not controlled by save-result option from global [options](https://arthas.aliyun.com/doc/en/options.html). No matter save-result is set to true or not, this command will write into `~/logs/arthas-cache/{PID}/{JobId}` anyway, instead of into `~/logs/arthas-cache/result.log`.
* Reference: https://arthas.aliyun.com/doc/async.html