代码拉取完成,页面将自动刷新
同步操作将从 plume开源社区/Plumelog 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
示例中plumelog相关版本号为示例,实际使用建议取最新的版本,最新的版如下
<dependency>
<groupId>com.plumelog</groupId>
<artifactId>plumelog-lite</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>com.plumelog</groupId>
<artifactId>plumelog-lite-spring-boot-starter</artifactId>
<version>3.5.3</version>
</dependency>
<appender name="plumelog" class="com.plumelog.lite.logback.appender.LiteAppender">
<appName>plumelog</appName>
<!-- 日志存储位置 -->
<logPath>/plumelog/lite</logPath>
<!-- 日志保留天数 -->
<keepDay>30</keepDay>
</appender>
<!-- 添加 ref-->
<root level="INFO">
<appender-ref ref="plumelog"/>
</root>
@ComponentScan("com.plumelog")
情况一:如果你的项目访问plumelog页面空白,说明没有配置可以访问静态文件请做如下配置 在application.properties配置:
spring.mvc.static-path-pattern=/**
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
情况二:拦截器会覆盖spring.resources.static-locations,如果项目中有拦截器,需要在拦截器里配置静态文件访问
示例:
import com.plumelog.core.PlumeLogTraceIdInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class TraceIdInterceptorsConfig extends WebMvcConfigurerAdapter{
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {"classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"};
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//就是这句addResourceLocations,加上静态文件访问路径
registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new PlumeLogTraceIdInterceptor());
super.addInterceptors(registry);
}
}
启动你的项目:输入你的项目地址+plumelog/#/访问,例如:http://localhost:8083/plumelog/#/ 一定要加这个/#/后缀
有些用3.5版本会报错:org.apache.lucene.store.LockObtainFailedException: Lock held by this virtual machine
情况一:springcloud-alibaba需要在你的启动类里面加:System.setProperty("spring.cloud.bootstrap.enabled", "false");
示例:
public static void main(String[] args) {
System.setProperty("spring.cloud.bootstrap.enabled", "false");
SpringApplication.run(LogServerStart.class, args);
}
情况二:如果用的logback.xml 改成logback-spring.xml;
情况三:用3.5.1以后版本
用3.5.2版本
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。