| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.EnvironmentAware; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class LogLocalServiceImpl implements ILogLocalService{ |
| | | public class LogLocalServiceImpl implements ILogLocalService, EnvironmentAware { |
| | | |
| | | /** |
| | | * 各个服务存放的的父路径 |
| | |
| | | */ |
| | | private Boolean isWindows = true; |
| | | |
| | | { |
| | | String os = System.getProperty("os.name").toLowerCase(); |
| | | //默认就配置为windows的,如果不是当前系统不是windows就需要对其转换为linux的文件路径格式 |
| | | /** |
| | | * 根据当前运行的环境,对配置的日志路径格式进行调整 |
| | | * @param environment |
| | | */ |
| | | @Override |
| | | public void setEnvironment(Environment environment) { |
| | | String os = environment.getProperty("os.name").toLowerCase(); |
| | | if (!os.contains("win")) { |
| | | this.PARENTPATH = this.PARENTPATH.substring(this.PARENTPATH.lastIndexOf(":") + 1).replace("\\", "/"); |
| | | this.LOGPATH = this.LOGPATH.replace("\\", "/"); |