9-Spring_Thread-1

1 篇文章 0 订阅

1.resume from break point

IO integration

2.thread create

{

1.extends Thread,and override the run(){

}

thread.run() & thread .start(),they are not the same

}

3.2ways to use the thread

     extend

     implements the runnable interface --> we create a Class and implements the Runable interface and put it's obj to the

Thread t1 = new Thread(obj) first time to see it

4.anonymous class

...i saw them in Android :

   new Thread(new Runable(){

           @override 

           public run(){

}

);

5.daemon thread

if the main thread dead, the user thread won't be influenced

but the daemon thread will perish with the dead of Main Thread

gc thread: garbage collection thread

if we setDaemon(true) the user Thread will die when main thread is dead

6.join

if we use the join mehtod, the other thread won't go until the join-thread is finished

Sum:

  ususally we use the thread pool,so we just know the basic knowledge

`classpath:logback-spring.xml` 是一个文件路径的表达式,它表示在类路径下查找名为 `logback-spring.xml` 的文件。 在使用 Spring Boot 时,`logback-spring.xml` 文件通常用于配置日志记录器和日志输出的方式。Spring Boot 默认支持 Logback 作为日志框架,因此你可以在类路径下创建一个名为 `logback-spring.xml` 的文件来配置日志。 你可以按照以下步骤来使用 `logback-spring.xml` 文件进行日志配置: 1. 在你的项目资源文件夹(一般是 `src/main/resources`)下创建一个名为 `logback-spring.xml` 的文件。 2. 在 `logback-spring.xml` 文件中,你可以使用 Logback 的 XML 配置语法来定义日志记录器、日志输出方式、日志格式等。你可以根据自己的需求进行配置。 以下是一个简单的 `logback-spring.xml` 文件示例,用于将日志输出到控制台: ```xml <configuration> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <root level="INFO"> <appender-ref ref="CONSOLE" /> </root> </configuration> ``` 这个示例配置了一个名为 `CONSOLE` 的控制台输出日志的 appender,并定义了日志输出的格式。 3. 将 `logback-spring.xml` 文件放置在类路径下,例如将它放置在 `src/main/resources` 目录下。 当你的应用程序启动时,它将自动加载并应用 `logback-spring.xml` 文件中的配置。 希望这能帮助到你进行日志配置。如果你有其他问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值