修改 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.context.annotation.EnableAspectJAutoProxy;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
|
||||||
@MapperScan("me.qwq.doghouse.dao")
|
@MapperScan("me.qwq.doghouse.dao")
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableAsync(proxyTargetClass=true)
|
@EnableAsync(proxyTargetClass=true)
|
||||||
@EnableCaching(proxyTargetClass=true)
|
@EnableCaching(proxyTargetClass=true)
|
||||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||||
|
@Slf4j
|
||||||
public class BlogApplication {
|
public class BlogApplication {
|
||||||
|
|
||||||
static Boolean isDebug = null;
|
static Boolean isDebug = null;
|
||||||
@@ -23,7 +26,9 @@ public class BlogApplication {
|
|||||||
|
|
||||||
if (isDebug == null) {
|
if (isDebug == null) {
|
||||||
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
|
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;
|
return isDebug;
|
||||||
}
|
}
|
||||||
@@ -33,8 +38,9 @@ public class BlogApplication {
|
|||||||
|
|
||||||
// 根据是否调试加载额外的 application-*.yml
|
// 根据是否调试加载额外的 application-*.yml
|
||||||
SpringApplication app = new SpringApplication(BlogApplication.class);
|
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);
|
app.run(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ spring:
|
|||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
'[me.qwq.doghouse]': debug
|
'[me.qwq.doghouse]': info
|
||||||
'[me.qwq.doghouse.dao]': warn
|
'[me.qwq.doghouse.dao]': warn
|
||||||
'[me.qwq.doghouse.interceptor.BlogInterceptor]': warn
|
'[me.qwq.doghouse.interceptor.BlogInterceptor]': warn
|
||||||
'[org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver]': error
|
'[org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver]': error
|
||||||
|
|||||||
Reference in New Issue
Block a user