Skip to content

Commit

Permalink
修改日志级别
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 authored and 88250 committed Nov 15, 2023
1 parent 92b7de6 commit dcbc95b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/java/org/b3log/symphony/util/Templates.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,24 @@ public final class Templates {
TEMPLATE_CFG.setDefaultEncoding("UTF-8");
try {
String path = Templates.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
LOGGER.info("Code source path: " + path);
LOGGER.info("Initial resource path: " + path); // 添加调试信息
LOGGER.log(Level.DEBUG, "Code source path: " + path);
if (StringUtils.contains(path, "/target/classes/") || StringUtils.contains(path, "/target/test-classes/")) {
// 开发时使用源码目录
path = StringUtils.replace(path, "/target/classes/", "/src/main/resources/");
path = StringUtils.replace(path, "/target/test-classes/", "/src/main/resources/");
LOGGER.info("Adjusted resource path for development environment: " + path); // 添加调试信息
LOGGER.log(Level.DEBUG, "Adjusted resource path for development environment: " + path); // 添加调试信息
}
if (StringUtils.contains(path, "/target/symphony/")) {
// 开发时使用源码目录
path = StringUtils.replace(path, "/target/symphony/", "/src/main/resources/");
LOGGER.info("Adjusted resource path for development environment: " + path); // 添加调试信息
LOGGER.log(Level.DEBUG, "Adjusted resource path for development environment: " + path); // 添加调试信息
}
path += "skins";
TEMPLATE_CFG.setDirectoryForTemplateLoading(new File(path));
LOGGER.log(Level.INFO, "Loaded template from directory [" + path + "]");
} catch (final Exception e) {
TEMPLATE_CFG.setClassForTemplateLoading(Templates.class, "/skins");
LOGGER.error("Failed to load template from directory, loading from classpath", e); // 记录错误信息
LOGGER.log(Level.INFO, "Failed to load template from directory, loading from classpath", e); // 记录错误信息
}
TEMPLATE_CFG.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
TEMPLATE_CFG.setLogTemplateExceptions(false);
Expand Down

0 comments on commit dcbc95b

Please sign in to comment.