新版博客编辑界面超级难受,考虑转战其他平台,比如博客园!!!
目录
■前言
·SpringBoot版本升级之后,log文件无法显示。
■原因
2.2.0版本之后,log的key变成了
logging.file.name
之前是
logging.file
■解决
application.properties或者application.yml文件中
logging
file
⇒
logging
file
name
■·SpringBoot源代码分析
2.1.6中,springboot的源码
---
package org.springframework.boot.logging;
import java.util.Properties;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* A reference to a log output file. Log output files are specified using
* {@code logging.file} or {@code logging.path} {@link Environment} properties. If the
* {@code logging.file} property is not specified {@code "spring.log"} will be written in
* the {@code logging.path} directory.
*
* @author Phillip Webb
* @since 1.2.1
* @see #get(PropertyResolver)
*/
public class LogFile {
/**
* The name of the Spring property that contains the name of the log file. Names can
* be an exact location or relative to the current directory.
*/
public static final String FILE_PROPERTY = "logging.file";
/**
* The name of the Spring property that contains the directory where log files are
* written.
*/
public static final String PATH_PROPERTY = "logging.path";
private final String file;
private final String path;
---
2.3.10中,springboot的源码
---
package org.springframework.boot.logging;
import java.io.File;
import java.util.Properties;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* A reference to a log output file. Log output files are specified using
* {@code logging.file.name} or {@code logging.file.path} {@link Environment} properties.
* If the {@code logging.file.name} property is not specified {@code "spring.log"} will be
* written in the {@code logging.file.path} directory.
*
* @author Phillip Webb
* @author Christian Carriere-Tisseur
* @since 1.2.1
* @see #get(PropertyResolver)
*/
public class LogFile {
/**
* The name of the Spring property that contains the name of the log file. Names can
* be an exact location or relative to the current directory.
* @since 2.2.0
*/
public static final String FILE_NAME_PROPERTY = "logging.file.name";
/**
* The name of the Spring property that contains the directory where log files are
* written.
* @since 2.2.0
*/
public static final String FILE_PATH_PROPERTY = "logging.file.path";
private final String file;
private final String path;
---