求解spring boot logback 日志输出路径问题

如题,我用spring boot 打包成 jar 。使用 logback 日志。想把日志输出到jar 文件所在的目录下,本地开发和放到linux 服务器上

clipboard.png

求解...

阅读 12k
3 个回答

springboot的log应该是在application.properties里配置的。

By default, Spring Boot will only log to the console and will not write log files. If you want to write log files in addition to the console output you need to set a logging.file or logging.path property (for example in your application.properties).

springboot文档

新手上路,请多包涵

有两种方式一个是通过application.properties 配置文件的方式来配置。
另一种是通过logback.xml配置文件的方式进行配置。
首先要说的是:application.properties 和logback.xml这两个配置文件都是放在 src/main/resources 目录下的。
先讲第一种application.properties
只要加入如下属性 logging.level.root=warn 即可让日志只输出warn及以上级别的信息。

在你的LOG_HOME那里,改成绝对路径不行吗

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题