修改 prod 的日志等级
This commit is contained in:
@@ -9,12 +9,15 @@ import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@MapperScan("me.qwq.doghouse.dao")
|
||||
@SpringBootApplication
|
||||
@EnableAsync(proxyTargetClass=true)
|
||||
@EnableCaching(proxyTargetClass=true)
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
@Slf4j
|
||||
public class BlogApplication {
|
||||
|
||||
static Boolean isDebug = null;
|
||||
@@ -23,7 +26,9 @@ public class BlogApplication {
|
||||
|
||||
if (isDebug == null) {
|
||||
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
|
||||
isDebug = runtimeMXBean.getInputArguments().toString().contains("-agentlib:jdwp");
|
||||
String runtimeMXBeanInputArguments = runtimeMXBean.getInputArguments().toString();
|
||||
log.debug("Runtime MXBean input arguments: {}", runtimeMXBeanInputArguments);
|
||||
isDebug = runtimeMXBeanInputArguments.contains("-agentlib:jdwp");
|
||||
}
|
||||
return isDebug;
|
||||
}
|
||||
@@ -33,8 +38,9 @@ public class BlogApplication {
|
||||
|
||||
// 根据是否调试加载额外的 application-*.yml
|
||||
SpringApplication app = new SpringApplication(BlogApplication.class);
|
||||
app.setAdditionalProfiles(isDebug ? "debug" : "prod");
|
||||
|
||||
String additionalProfiles = isDebug ? "debug" : "prod";
|
||||
app.setAdditionalProfiles(additionalProfiles);
|
||||
log.info("Current is {}debug, set additional profiles: {}", isDebug ? "" : "not ", additionalProfiles);
|
||||
app.run(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ spring:
|
||||
|
||||
logging:
|
||||
level:
|
||||
'[me.qwq.doghouse]': debug
|
||||
'[me.qwq.doghouse]': info
|
||||
'[me.qwq.doghouse.dao]': warn
|
||||
'[me.qwq.doghouse.interceptor.BlogInterceptor]': warn
|
||||
'[org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver]': error
|
||||
|
||||
Reference in New Issue
Block a user