mirror of
https://gitee.com/arthas/arthas.git
synced 2024-12-02 12:17:45 +08:00
parent
e3283f0439
commit
f36959bfcf
@ -30,7 +30,7 @@ English version goes [here](README.md).
|
|||||||
|
|
||||||
### [在线教程(推荐)](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn)
|
### [在线教程(推荐)](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn)
|
||||||
|
|
||||||
* [Usages](tutorials/katacoda/README_CN.md#在线教程使用方法)
|
* [使用方法](tutorials/katacoda/README_CN.md#在线教程使用方法)
|
||||||
|
|
||||||
### 快速开始
|
### 快速开始
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ $ classloader -t
|
|||||||
|
|
||||||
比如上面查看到的spring LaunchedURLClassLoader的 hashcode是`1be6f5c3`,可以通过`-c`或者`--classLoaderClass`参数来列出它的所有urls:
|
比如上面查看到的spring LaunchedURLClassLoader的 hashcode是`1be6f5c3`,可以通过`-c`或者`--classLoaderClass`参数来列出它的所有urls:
|
||||||
|
|
||||||
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader`
|
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader`{{execute T2}}
|
||||||
|
|
||||||
```
|
```
|
||||||
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader
|
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader
|
||||||
@ -100,7 +100,7 @@ jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/spri
|
|||||||
|
|
||||||
### 加载指定ClassLoader里的资源文件
|
### 加载指定ClassLoader里的资源文件
|
||||||
|
|
||||||
查找指定的资源文件: `classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml`
|
查找指定的资源文件: `classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml`{{execute T2}}
|
||||||
|
|
||||||
```
|
```
|
||||||
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml
|
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml
|
||||||
@ -111,7 +111,7 @@ $ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClas
|
|||||||
|
|
||||||
比如用上面的spring LaunchedURLClassLoader 尝试加载 `java.lang.String` :
|
比如用上面的spring LaunchedURLClassLoader 尝试加载 `java.lang.String` :
|
||||||
|
|
||||||
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String`
|
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String`{{execute T2}}
|
||||||
|
|
||||||
```
|
```
|
||||||
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String
|
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String
|
||||||
|
@ -89,7 +89,7 @@ Note: Please replace `<classLoaderHash>` with your classLoaderHash above, then e
|
|||||||
|
|
||||||
For example, the hashcode of spring `LaunchedURLClassLoader` viewed above is `1be6f5c3`, and all its urls can be listed by the `-c` parameter:
|
For example, the hashcode of spring `LaunchedURLClassLoader` viewed above is `1be6f5c3`, and all its urls can be listed by the `-c` parameter:
|
||||||
|
|
||||||
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader`
|
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader`{{execute T2}}
|
||||||
|
|
||||||
```
|
```
|
||||||
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader
|
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader
|
||||||
@ -101,7 +101,7 @@ jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/spri
|
|||||||
|
|
||||||
### Load the resource file in the specified ClassLoader
|
### Load the resource file in the specified ClassLoader
|
||||||
|
|
||||||
Load the specified resource file: `classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml`
|
Load the specified resource file: `classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml`{{execute T2}}
|
||||||
|
|
||||||
```
|
```
|
||||||
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml
|
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader -r logback-spring.xml
|
||||||
@ -112,7 +112,7 @@ $ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClas
|
|||||||
|
|
||||||
For example, try loading `java.lang.String` with spring LaunchedURLClassLoader :
|
For example, try loading `java.lang.String` with spring LaunchedURLClassLoader :
|
||||||
|
|
||||||
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String`
|
`classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String`{{execute T2}}
|
||||||
|
|
||||||
```
|
```
|
||||||
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String
|
$ classloader --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --load java.lang.String
|
||||||
|
14
tutorials/katacoda/case-classloader-cn/start-demo.md
Normal file
14
tutorials/katacoda/case-classloader-cn/start-demo.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
下载`demo-arthas-spring-boot.jar`,再用`java -jar`命令启动:
|
||||||
|
|
||||||
|
`wget https://github.com/hengyunabc/spring-boot-inside/raw/master/demo-arthas-spring-boot/demo-arthas-spring-boot.jar
|
||||||
|
java -jar demo-arthas-spring-boot.jar`{{execute T1}}
|
||||||
|
|
||||||
|
`demo-arthas-spring-boot`是一个很简单的spring boot应用,源代码:[查看](https://github.com/hengyunabc/spring-boot-inside/tree/master/demo-arthas-spring-boot)
|
||||||
|
|
||||||
|
启动之后,可以访问80端口: https://[[HOST_SUBDOMAIN]]-80-[[KATACODA_HOST]].environments.katacoda.com
|
||||||
|
|
||||||
|
![Demo Web](/arthas/scenarios/common-resources/assets/demo-web.png)
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"title": "Arthas Basics",
|
"title": "Arthas Help Command",
|
||||||
"description": "Arthas Basics",
|
"description": "Arthas Help Command",
|
||||||
"details": {
|
"details": {
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
|
@ -9,29 +9,21 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger
|
[arthas@2062]$ logger
|
||||||
name ROOT
|
name ROOT
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level INFO
|
level INFO
|
||||||
effectiveLevel INFO
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity true
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
appenders name CONSOLE
|
c-1.1.11.jar!/
|
||||||
class ch.qos.logback.core.ConsoleAppender
|
appenders name CONSOLE
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
class ch.qos.logback.core.ConsoleAppender
|
||||||
classLoaderHash 2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
target System.out
|
classLoaderHash 5674cd4d
|
||||||
name APPLICATION
|
target System.out
|
||||||
class ch.qos.logback.core.rolling.RollingFileAppender
|
...
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
file app.log
|
|
||||||
name ASYNC
|
|
||||||
class ch.qos.logback.classic.AsyncAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
appenderRef [APPLICATION]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -41,17 +33,18 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger -n org.springframework.web
|
[arthas@2062]$ logger -n org.springframework.web
|
||||||
name org.springframework.web
|
name org.springframework.web
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level null
|
level null
|
||||||
effectiveLevel INFO
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity true
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
|
c-1.1.11.jar!/
|
||||||
```
|
```
|
||||||
|
|
||||||
请记下你的classLoaderHash,后面需要使用它。在这里,它是 `2a139a55`。
|
请记下你的classLoaderHash,后面需要使用它。在这里,它是 `5674cd4d`。
|
||||||
|
|
||||||
注意:请使用你的classLoaderHash值覆盖 `<classLoaderHash>` ,然后手动执行下面所述命令:
|
注意:请使用你的classLoaderHash值覆盖 `<classLoaderHash>` ,然后手动执行下面所述命令:
|
||||||
|
|
||||||
@ -62,42 +55,32 @@
|
|||||||
如果你使用`-c`,你需要手动输入hashcode:`-c <hashcode>`
|
如果你使用`-c`,你需要手动输入hashcode:`-c <hashcode>`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ logger -c 2a139a55
|
$ logger -c 5674cd4d
|
||||||
```
|
```
|
||||||
|
|
||||||
对于只有唯一实例的ClassLoader可以通过`--classLoaderClass`指定class name,使用起来更加方便:
|
对于只有唯一实例的ClassLoader可以通过`--classLoaderClass`指定class name,使用起来更加方便:
|
||||||
|
|
||||||
`logger --classLoaderClass sun.misc.Launcher$AppClassLoader`{{execute T2}}
|
`logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader`{{execute T2}}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger --classLoaderClass sun.misc.Launcher$AppClassLoader
|
[arthas@2062]$ logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader
|
||||||
name ROOT
|
name ROOT
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level DEBUG
|
level INFO
|
||||||
effectiveLevel DEBUG
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity true
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
appenders name CONSOLE
|
c-1.1.11.jar!/
|
||||||
class ch.qos.logback.core.ConsoleAppender
|
appenders name CONSOLE
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
class ch.qos.logback.core.ConsoleAppender
|
||||||
classLoaderHash 2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
target System.out
|
classLoaderHash 5674cd4d
|
||||||
name APPLICATION
|
target System.out
|
||||||
class ch.qos.logback.core.rolling.RollingFileAppender
|
...
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
file app.log
|
|
||||||
name ASYNC
|
|
||||||
class ch.qos.logback.classic.AsyncAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
appenderRef [APPLICATION]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* 注: 这里classLoaderClass 在 java 8 是 sun.misc.Launcher$AppClassLoader,而java 11的classloader是jdk.internal.loader.ClassLoaders$AppClassLoader,katacoda目前环境是java8。
|
|
||||||
|
|
||||||
`--classLoaderClass` 的值是ClassLoader的类名,只有匹配到唯一的ClassLoader实例时才能工作,目的是方便输入通用命令,而`-c <hashcode>`是动态变化的。
|
`--classLoaderClass` 的值是ClassLoader的类名,只有匹配到唯一的ClassLoader实例时才能工作,目的是方便输入通用命令,而`-c <hashcode>`是动态变化的。
|
||||||
|
|
||||||
#### 更新logger level
|
#### 更新logger level
|
||||||
@ -109,16 +92,18 @@ $ logger -c 2a139a55
|
|||||||
update logger level success.
|
update logger level success.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
注意:在教程中执行会提示错误,需要指定classloader
|
||||||
|
|
||||||
#### 指定classloader更新 logger level
|
#### 指定classloader更新 logger level
|
||||||
|
|
||||||
默认情况下,logger命令会在SystemClassloader下执行,如果应用是传统的`war`应用,或者spring boot fat jar启动的应用,那么需要指定classloader。
|
默认情况下,logger命令会在SystemClassloader下执行,如果应用是传统的`war`应用,或者spring boot fat jar启动的应用,那么需要指定classloader。
|
||||||
|
|
||||||
可以先用 `sc -d yourClassName` 来查看具体的 classloader hashcode,然后在更新level时指定classloader:
|
可以先用 `sc -d yourClassName` 来查看具体的 classloader hashcode,然后在更新level时指定classloader:
|
||||||
|
|
||||||
`logger --classLoaderClass sun.misc.Launcher$AppClassLoader --name ROOT --level debug`{{execute T2}}
|
`logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --name ROOT --level debug`{{execute T2}}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger --classLoaderClass sun.misc.Launcher$AppClassLoader --name ROOT --level debug
|
[arthas@2062]$ logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --name ROOT --level debug
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 查看没有appender的logger的信息
|
#### 查看没有appender的logger的信息
|
||||||
@ -132,46 +117,18 @@ update logger level success.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger --include-no-appender
|
[arthas@2062]$ logger --include-no-appender
|
||||||
name ROOT
|
name org.thymeleaf
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level DEBUG
|
level null
|
||||||
effectiveLevel DEBUG
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity false
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
appenders name CONSOLE
|
c-1.1.11.jar!/
|
||||||
class ch.qos.logback.core.ConsoleAppender
|
appenders name DEBUG_LEVEL_REMAPPER
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
class org.springframework.boot.logging.logback.LevelRemappingAppender
|
||||||
classLoaderHash 2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
target System.out
|
classLoaderHash 5674cd4d
|
||||||
name APPLICATION
|
|
||||||
class ch.qos.logback.core.rolling.RollingFileAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
file app.log
|
|
||||||
name ASYNC
|
|
||||||
class ch.qos.logback.classic.AsyncAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
appenderRef [APPLICATION]
|
|
||||||
|
|
||||||
name com
|
|
||||||
class ch.qos.logback.classic.Logger
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
level null
|
|
||||||
effectiveLevel DEBUG
|
|
||||||
additivity true
|
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
|
||||||
|
|
||||||
name com.alibaba
|
|
||||||
class ch.qos.logback.classic.Logger
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
level null
|
|
||||||
effectiveLevel DEBUG
|
|
||||||
additivity true
|
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Download `arthas-demo.jar` and start with the `java -jar` command:
|
|
||||||
|
|
||||||
`wget https://arthas.aliyun.com/arthas-demo.jar
|
|
||||||
java -jar arthas-demo.jar`{{execute T1}}
|
|
||||||
|
|
||||||
`arthas-demo` is a very simple program that randomly generates integers, performs factorization, and prints the results.
|
|
||||||
If the generated random number is negative, a error message will be printed.
|
|
@ -6,8 +6,8 @@
|
|||||||
"details": {
|
"details": {
|
||||||
"steps": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"title": "Arthas demo",
|
"title": "Start demo",
|
||||||
"text": "arthas-demo.md"
|
"text": "start-demo.md"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Start arthas-boot",
|
"title": "Start arthas-boot",
|
||||||
|
@ -9,29 +9,21 @@ Print the logger information, update the logger level
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger
|
[arthas@2062]$ logger
|
||||||
name ROOT
|
name ROOT
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level INFO
|
level INFO
|
||||||
effectiveLevel INFO
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity true
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
appenders name CONSOLE
|
c-1.1.11.jar!/
|
||||||
class ch.qos.logback.core.ConsoleAppender
|
appenders name CONSOLE
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
class ch.qos.logback.core.ConsoleAppender
|
||||||
classLoaderHash 2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
target System.out
|
classLoaderHash 5674cd4d
|
||||||
name APPLICATION
|
target System.out
|
||||||
class ch.qos.logback.core.rolling.RollingFileAppender
|
...
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
file app.log
|
|
||||||
name ASYNC
|
|
||||||
class ch.qos.logback.classic.AsyncAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
appenderRef [APPLICATION]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### View logger information for the special name
|
#### View logger information for the special name
|
||||||
@ -40,18 +32,19 @@ Print the logger information, update the logger level
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger -n org.springframework.web
|
[arthas@2062]$ logger -n org.springframework.web
|
||||||
name org.springframework.web
|
name org.springframework.web
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level null
|
level null
|
||||||
effectiveLevel INFO
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity true
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
|
c-1.1.11.jar!/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Please write down your classLoaderHash here, in the case here, it's `2a139a55`. It will be used in the future steps.
|
Please write down your classLoaderHash here, in the case here, it's `5674cd4d`. It will be used in the future steps.
|
||||||
|
|
||||||
Note: Please replace `<classLoaderHash>` with your classLoaderHash above, then execute the commands manually in the following steps:
|
Note: Please replace `<classLoaderHash>` with your classLoaderHash above, then execute the commands manually in the following steps:
|
||||||
|
|
||||||
@ -62,42 +55,32 @@ Note that the hashcode changes, you need to check the current ClassLoader inform
|
|||||||
if you use`-c`, you have to manually type hashcode by `-c <hashcode>`.
|
if you use`-c`, you have to manually type hashcode by `-c <hashcode>`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ logger -c 2a139a55
|
$ logger -c 5674cd4d
|
||||||
```
|
```
|
||||||
|
|
||||||
For classloader with only one instance, it can be specified by `--classLoaderClass` using class name, which is more convenient to use.
|
For classloader with only one instance, it can be specified by `--classLoaderClass` using class name, which is more convenient to use.
|
||||||
|
|
||||||
`logger --classLoaderClass sun.misc.Launcher$AppClassLoader`{{execute T2}}
|
`logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader`{{execute T2}}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger --classLoaderClass sun.misc.Launcher$AppClassLoader
|
[arthas@2062]$ logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader
|
||||||
name ROOT
|
name ROOT
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level DEBUG
|
level INFO
|
||||||
effectiveLevel DEBUG
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity true
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
appenders name CONSOLE
|
c-1.1.11.jar!/
|
||||||
class ch.qos.logback.core.ConsoleAppender
|
appenders name CONSOLE
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
class ch.qos.logback.core.ConsoleAppender
|
||||||
classLoaderHash 2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
target System.out
|
classLoaderHash 5674cd4d
|
||||||
name APPLICATION
|
target System.out
|
||||||
class ch.qos.logback.core.rolling.RollingFileAppender
|
...
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
file app.log
|
|
||||||
name ASYNC
|
|
||||||
class ch.qos.logback.classic.AsyncAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
appenderRef [APPLICATION]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* PS: Here the classLoaderClass in java 8 is sun.misc.Launcher$AppClassLoader, while in java 11 it's jdk.internal.loader.ClassLoaders$AppClassLoader. Currently katacoda using java 8.
|
|
||||||
|
|
||||||
The value of `--classloaderclass` is the class name of classloader. It can only work when it matches a unique classloader instance. The purpose is to facilitate the input of general commands. However, `-c <hashcode>` is dynamic.
|
The value of `--classloaderclass` is the class name of classloader. It can only work when it matches a unique classloader instance. The purpose is to facilitate the input of general commands. However, `-c <hashcode>` is dynamic.
|
||||||
|
|
||||||
#### Update logger level
|
#### Update logger level
|
||||||
@ -109,16 +92,18 @@ The value of `--classloaderclass` is the class name of classloader. It can only
|
|||||||
update logger level success.
|
update logger level success.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
PS: Here it will come up with an error message in tutorial, we have to specify the classloader.
|
||||||
|
|
||||||
#### Speecify classloader to update logger level
|
#### Speecify classloader to update logger level
|
||||||
|
|
||||||
By default,logger command will be executed under SystemClassloader, if the application is a traditional `war`, or using spring boot fat jar, then it needs to specify classloader。
|
By default,logger command will be executed under SystemClassloader, if the application is a traditional `war`, or using spring boot fat jar, then it needs to specify classloader。
|
||||||
|
|
||||||
You can first use `sc -d yourClassName` to check specified classloader hashcode,then specify classloader when updating logger level:
|
You can first use `sc -d yourClassName` to check specified classloader hashcode,then specify classloader when updating logger level:
|
||||||
|
|
||||||
`logger --classLoaderClass sun.misc.Launcher$AppClassLoader --name ROOT --level debug`{{execute T2}}
|
`logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --name ROOT --level debug`{{execute T2}}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger --classLoaderClass sun.misc.Launcher$AppClassLoader --name ROOT --level debug
|
[arthas@2062]$ logger --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --name ROOT --level debug
|
||||||
```
|
```
|
||||||
|
|
||||||
#### View the logger information without appenders
|
#### View the logger information without appenders
|
||||||
@ -132,46 +117,18 @@ Note that the output will usually be very long.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
[arthas@2062]$ logger --include-no-appender
|
[arthas@2062]$ logger --include-no-appender
|
||||||
name ROOT
|
name org.thymeleaf
|
||||||
class ch.qos.logback.classic.Logger
|
class ch.qos.logback.classic.Logger
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
classLoaderHash 2a139a55
|
classLoaderHash 5674cd4d
|
||||||
level DEBUG
|
level null
|
||||||
effectiveLevel DEBUG
|
effectiveLevel INFO
|
||||||
additivity true
|
additivity false
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
codeSource jar:file:/home/scrapbook/tutorial/demo-arthas-spring-boot.jar!/BOOT-INF/lib/logback-classi
|
||||||
appenders name CONSOLE
|
c-1.1.11.jar!/
|
||||||
class ch.qos.logback.core.ConsoleAppender
|
appenders name DEBUG_LEVEL_REMAPPER
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
class org.springframework.boot.logging.logback.LevelRemappingAppender
|
||||||
classLoaderHash 2a139a55
|
classLoader org.springframework.boot.loader.LaunchedURLClassLoader@5674cd4d
|
||||||
target System.out
|
classLoaderHash 5674cd4d
|
||||||
name APPLICATION
|
|
||||||
class ch.qos.logback.core.rolling.RollingFileAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
file app.log
|
|
||||||
name ASYNC
|
|
||||||
class ch.qos.logback.classic.AsyncAppender
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
appenderRef [APPLICATION]
|
|
||||||
|
|
||||||
name com
|
|
||||||
class ch.qos.logback.classic.Logger
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
level null
|
|
||||||
effectiveLevel DEBUG
|
|
||||||
additivity true
|
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
|
||||||
|
|
||||||
name com.alibaba
|
|
||||||
class ch.qos.logback.classic.Logger
|
|
||||||
classLoader sun.misc.Launcher$AppClassLoader@2a139a55
|
|
||||||
classLoaderHash 2a139a55
|
|
||||||
level null
|
|
||||||
effectiveLevel DEBUG
|
|
||||||
additivity true
|
|
||||||
codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
14
tutorials/katacoda/command-logger-en/start-demo.md
Normal file
14
tutorials/katacoda/command-logger-en/start-demo.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Download `demo-arthas-spring-boot.jar`, and start with `java -jar` command:
|
||||||
|
|
||||||
|
`wget https://github.com/hengyunabc/spring-boot-inside/raw/master/demo-arthas-spring-boot/demo-arthas-spring-boot.jar
|
||||||
|
java -jar demo-arthas-spring-boot.jar`{{execute T1}}
|
||||||
|
|
||||||
|
`demo-arthas-spring-boot` is a simple Spring Boot demo, the source code here: [View](https://github.com/hengyunabc/spring-boot-inside/tree/master/demo-arthas-spring-boot)
|
||||||
|
|
||||||
|
After booting, access port 80: https://[[HOST_SUBDOMAIN]]-80-[[KATACODA_HOST]].environments.katacoda.com
|
||||||
|
|
||||||
|
![Demo Web](/arthas/scenarios/common-resources/assets/demo-web.png)
|
Loading…
Reference in New Issue
Block a user