@@ -0,0 +1,31 @@ | |||
HELP.md | |||
target/ | |||
!.mvn/wrapper/maven-wrapper.jar | |||
!**/src/main/** | |||
!**/src/test/** | |||
### STS ### | |||
.apt_generated | |||
.classpath | |||
.factorypath | |||
.project | |||
.settings | |||
.springBeans | |||
.sts4-cache | |||
### IntelliJ IDEA ### | |||
.idea | |||
*.iws | |||
*.iml | |||
*.ipr | |||
### NetBeans ### | |||
/nbproject/private/ | |||
/nbbuild/ | |||
/dist/ | |||
/nbdist/ | |||
/.nb-gradle/ | |||
build/ | |||
### VS Code ### | |||
.vscode/ |
@@ -0,0 +1,10 @@ | |||
FROM java:8 | |||
MAINTAINER king <1609724385@qq.com> | |||
VOLUME /tmp | |||
COPY target/dipperposition.jar dipperposition.jar | |||
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas | |||
ENV TimeZone=Asia/Shanghai | |||
ENV active=dev | |||
ENV JAVA_OPTS="-Xmx256M -Xms256M" | |||
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone | |||
ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /dipperposition.jar --spring.profiles.active=$active |
@@ -0,0 +1,127 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xmlns="http://maven.apache.org/POM/4.0.0" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>com.telpo</groupId> | |||
<artifactId>dipperposition</artifactId> | |||
<version>1.0-SNAPSHOT</version> | |||
<name>dipperposition</name> | |||
<description>北斗定位服务</description> | |||
<packaging>jar</packaging> | |||
<parent> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-parent</artifactId> | |||
<version>2.2.5.RELEASE</version> | |||
</parent> | |||
<properties> | |||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||
<java.version>1.8</java.version> | |||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> | |||
<spring-cloud-alibaba.version>2.2.0.RELEASE</spring-cloud-alibaba.version> | |||
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version> | |||
<skipTests>true</skipTests> | |||
</properties> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-devtools</artifactId> | |||
<scope>runtime</scope> | |||
<optional>true</optional> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.projectlombok</groupId> | |||
<artifactId>lombok</artifactId> | |||
<optional>true</optional> | |||
</dependency> | |||
<!-- springcloud alibaba依赖包--> | |||
<dependency> | |||
<groupId>com.alibaba.cloud</groupId> | |||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba.cloud</groupId> | |||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-webflux</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-configuration-processor</artifactId> | |||
<optional>true</optional> | |||
</dependency> | |||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-lang3</artifactId> | |||
<version>3.10</version> | |||
</dependency> | |||
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-client --> | |||
<dependency> | |||
<groupId>de.codecentric</groupId> | |||
<artifactId>spring-boot-admin-starter-client</artifactId> | |||
<version>2.2.4</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba</groupId> | |||
<artifactId>fastjson</artifactId> | |||
<version>1.2.28</version> | |||
</dependency> | |||
</dependencies> | |||
<dependencyManagement> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.springframework.cloud</groupId> | |||
<artifactId>spring-cloud-dependencies</artifactId> | |||
<version>${spring-cloud.version}</version> | |||
<type>pom</type> | |||
<scope>import</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba.cloud</groupId> | |||
<artifactId>spring-cloud-alibaba-dependencies</artifactId> | |||
<version>${spring-cloud-alibaba.version}</version> | |||
<type>pom</type> | |||
<scope>import</scope> | |||
</dependency> | |||
</dependencies> | |||
</dependencyManagement> | |||
<build> | |||
<finalName>${project.artifactId}</finalName> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-maven-plugin</artifactId> | |||
<configuration> | |||
<!--fork : 使用 devtools生效--> | |||
<fork>true</fork> | |||
</configuration> | |||
<executions> | |||
<execution> | |||
<goals> | |||
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中--> | |||
</goals> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
</project> |
@@ -0,0 +1,30 @@ | |||
#!/bin/bash | |||
environment=$1 | |||
version=$2 | |||
echo "环境变量为${environment},版本为$version!" | |||
if [[ ${environment} == 'production' ]]; then | |||
echo "开始远程构建容器" | |||
docker stop dipperposition_service || true | |||
docker rm dipperposition_service || true | |||
docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/rzl_adapter | awk '{print $3}') | |||
docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com | |||
docker pull registry.cn-shanghai.aliyuncs.com/telpo_platform/dipperposition_service:$version | |||
docker run -e active=pro -v /home/data/dipperposition/log:/var/log/dipperposition --restart=always -p 8092:8092 -d --name dipperposition_service registry.cn-shanghai.aliyuncs.com/telpo_platform/dipperposition_service:$version | |||
#删除产生的None镜像 | |||
docker rmi -f $(docker images | grep none | awk '{print $3}') | |||
docker ps -a | |||
else | |||
if [[ ${environment} == 'test' ]]; then | |||
#echo "开始远程构建容器" | |||
docker stop dipperposition_service || true | |||
docker rm dipperposition_service || true | |||
docker rmi -f $(docker images | grep 139.224.254.18:5000/dipperposition_service | awk '{print $3}') | |||
docker pull 139.224.254.18:5000/rzl_adapter:$version | |||
docker run -v /home/data/dipperposition/log:/var/log/dipperposition -e active=test --restart=always -d --network host --name dipperposition_service 139.224.254.18:5000/dipperposition_service:$version | |||
#删除产生的None镜像 | |||
docker rmi -f $(docker images | grep none | awk '{print $3}') | |||
docker ps -a | |||
fi | |||
fi |
@@ -0,0 +1,27 @@ | |||
#!/bin/bash | |||
mvn clean | |||
mvn package -Dmaven.test.skip=true | |||
#image_version=$(date +%Y%m%d%H%M) | |||
image_version=$version | |||
docker stop dipperposition_service || true | |||
docker rm dipperposition_service || true | |||
# 删除镜像 | |||
docker rmi -f $(docker images | grep telpo/dipperposition_service | awk '{print $3}') | |||
docker build . -t telpo/rzl_adapter:$image_version | |||
#TODO:推送镜像到私有仓库 | |||
echo '=================开始推送镜像=======================' | |||
docker tag telpo/dipperposition_service:$image_version 139.224.254.18:5000/dipperposition_service:$image_version | |||
docker push 139.224.254.18:5000/dipperposition_service:$image_version | |||
echo '=================推送镜像完成=======================' | |||
#删除产生的None镜像 | |||
docker rmi -f $(docker images | grep none | awk '{print $3}') | |||
# 查看镜像列表 | |||
docker images | |||
# 启动容器 | |||
docker run -v /home/data/dipperposition/log:/var/log/dipperposition -d -e active=dev --network host --restart=always --name dipperposition_service 139.224.254.18:5000/dipperposition_service:$image_version | |||
# 查看日志 | |||
# docker logs dipperposition_service |
@@ -0,0 +1,20 @@ | |||
#!/usr/bin/env bash | |||
mvn clean | |||
mvn package -Dmaven.test.skip=true | |||
image_version=$version | |||
# 删除镜像 | |||
docker rmi -f $( | |||
docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/dipperposition_service | awk '{print $3}' | |||
) | |||
# 构建telpo/mrp:$image_version镜像 | |||
docker build . -t telpo/dipperposition_service:$image_version | |||
#TODO:推送镜像到阿里仓库 | |||
echo '=================开始推送镜像=======================' | |||
docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com | |||
docker tag telpo/dipperposition_service:$image_version registry.cn-shanghai.aliyuncs.com/telpo_platform/dipperposition_service:$image_version | |||
docker push registry.cn-shanghai.aliyuncs.com/telpo_platform/dipperposition_service:$image_version | |||
echo '=================推送镜像完成=======================' | |||
#删除产生的None镜像 | |||
docker rmi -f $(docker images | grep none | awk '{print $3}') | |||
# 查看镜像列表 | |||
docker images |
@@ -0,0 +1,27 @@ | |||
#!/bin/bash | |||
mvn clean | |||
mvn package -Dmaven.test.skip=true | |||
#image_version=$(date +%Y%m%d%H%M) | |||
image_version=$version | |||
docker stop dipperposition_service || true | |||
docker rm dipperposition_service || true | |||
# 删除镜像 | |||
docker rmi -f $(docker images | grep telpo/dipperposition_service | awk '{print $3}') | |||
docker build . -t telpo/dipperposition_service:$image_version | |||
#TODO:推送镜像到私有仓库 | |||
echo '=================开始推送镜像=======================' | |||
docker tag telpo/dipperposition_service:$image_version 139.224.254.18:5000/dipperposition_service:$image_version | |||
docker push 139.224.254.18:5000/dipperposition_service:$image_version | |||
echo '=================推送镜像完成=======================' | |||
#删除产生的None镜像 | |||
docker rmi -f $(docker images | grep none | awk '{print $3}') | |||
# 查看镜像列表 | |||
docker images | |||
# 启动容器 | |||
docker run -v /home/data/dipperposition/log:/var/log/dipperposition -d -e active=test --network host --restart=always --name dipperposition_service 139.224.254.18:5000/dipperposition_service:$image_version | |||
# 查看日志 | |||
# docker logs dipperposition_service |
@@ -0,0 +1,24 @@ | |||
package com.telpo.dipperposition; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.boot.SpringApplication; | |||
import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | |||
import org.springframework.cloud.openfeign.EnableFeignClients; | |||
/** | |||
* @program: gateway | |||
* @description: 网关启动类 | |||
* @author: linwl | |||
* @create: 2020-06-18 16:39 | |||
*/ | |||
@SpringBootApplication | |||
@EnableDiscoveryClient | |||
@Slf4j | |||
public class DipperPositionApplication { | |||
public static void main(String[] args) { | |||
SpringApplication.run(DipperPositionApplication.class, args); | |||
log.info("北斗定位服务启动!"); | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
package com.telpo.dipperposition.controller; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.client.RestTemplate; | |||
import java.time.Duration; | |||
import java.time.LocalDateTime; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @program: DipperPositionController | |||
* @description: 北斗定位 | |||
* @author: linwl | |||
* @create: 2020-07-10 14:01 | |||
*/ | |||
@RestController | |||
@Slf4j | |||
public class DipperPositionController { | |||
@RequestMapping("/getPos") | |||
public String getCampusListJson() { | |||
return "Helle world!"; | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
spring: | |||
main: | |||
allow-bean-definition-overriding: true | |||
application: | |||
name: dipperposition-service | |||
cloud: | |||
nacos: | |||
config: | |||
server-addr: 172.16.192.26:8848 | |||
file-extension: yml |
@@ -0,0 +1,10 @@ | |||
spring: | |||
main: | |||
allow-bean-definition-overriding: true | |||
application: | |||
name: dipperposition-service | |||
cloud: | |||
nacos: | |||
config: | |||
server-addr: 172.19.42.38:8848 | |||
file-extension: yml |
@@ -0,0 +1,10 @@ | |||
spring: | |||
main: | |||
allow-bean-definition-overriding: true | |||
application: | |||
name: dipperposition-service | |||
cloud: | |||
nacos: | |||
config: | |||
server-addr: 172.19.42.44:8848 | |||
file-extension: yml |
@@ -0,0 +1,10 @@ | |||
spring: | |||
main: | |||
allow-bean-definition-overriding: true | |||
application: | |||
name: dipperposition-service | |||
cloud: | |||
nacos: | |||
config: | |||
server-addr: 172.16.192.26:8848 | |||
file-extension: yml |
@@ -0,0 +1,197 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> | |||
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true --> | |||
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> | |||
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> | |||
<configuration scan="true" scanPeriod="10 seconds"> | |||
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />--> | |||
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 --> | |||
<property name="log.path" value="/var/log/rzladapter"/> | |||
<!-- 彩色日志 --> | |||
<!-- 彩色日志依赖的渲染类 --> | |||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> | |||
<conversionRule conversionWord="wex" | |||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> | |||
<conversionRule conversionWord="wEx" | |||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> | |||
<!-- 彩色日志格式 --> | |||
<property name="CONSOLE_LOG_PATTERN" | |||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> | |||
<!--输出到控制台--> | |||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |||
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | |||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |||
<level>debug</level> | |||
</filter> | |||
<encoder> | |||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | |||
<!-- 设置字符集 --> | |||
<charset>UTF-8</charset> | |||
</encoder> | |||
</appender> | |||
<!--输出到文件--> | |||
<!-- 时间滚动输出 level为 DEBUG 日志 --> | |||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
<!-- 正在记录的日志文件的路径及文件名 --> | |||
<file>${log.path}/log_debug.log</file> | |||
<!--日志文件输出格式--> | |||
<encoder> | |||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
<charset>UTF-8</charset> <!-- 设置字符集 --> | |||
</encoder> | |||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
<!-- 日志归档 --> | |||
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
<maxFileSize>100MB</maxFileSize> | |||
</timeBasedFileNamingAndTriggeringPolicy> | |||
<!--日志文件保留天数--> | |||
<maxHistory>15</maxHistory> | |||
</rollingPolicy> | |||
<!-- 此日志文件只记录debug级别的 --> | |||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
<level>debug</level> | |||
<onMatch>ACCEPT</onMatch> | |||
<onMismatch>DENY</onMismatch> | |||
</filter> | |||
</appender> | |||
<!-- 时间滚动输出 level为 INFO 日志 --> | |||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
<!-- 正在记录的日志文件的路径及文件名 --> | |||
<file>${log.path}/log_info.log</file> | |||
<!--日志文件输出格式--> | |||
<encoder> | |||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
<charset>UTF-8</charset> | |||
</encoder> | |||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
<!-- 每天日志归档路径以及格式 --> | |||
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
<maxFileSize>100MB</maxFileSize> | |||
</timeBasedFileNamingAndTriggeringPolicy> | |||
<!--日志文件保留天数--> | |||
<maxHistory>15</maxHistory> | |||
</rollingPolicy> | |||
<!-- 此日志文件只记录info级别的 --> | |||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
<level>info</level> | |||
<onMatch>ACCEPT</onMatch> | |||
<onMismatch>DENY</onMismatch> | |||
</filter> | |||
</appender> | |||
<!-- 时间滚动输出 level为 WARN 日志 --> | |||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
<!-- 正在记录的日志文件的路径及文件名 --> | |||
<file>${log.path}/log_warn.log</file> | |||
<!--日志文件输出格式--> | |||
<encoder> | |||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
</encoder> | |||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
<maxFileSize>100MB</maxFileSize> | |||
</timeBasedFileNamingAndTriggeringPolicy> | |||
<!--日志文件保留天数--> | |||
<maxHistory>15</maxHistory> | |||
</rollingPolicy> | |||
<!-- 此日志文件只记录warn级别的 --> | |||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
<level>warn</level> | |||
<onMatch>ACCEPT</onMatch> | |||
<onMismatch>DENY</onMismatch> | |||
</filter> | |||
</appender> | |||
<!-- 时间滚动输出 level为 ERROR 日志 --> | |||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
<!-- 正在记录的日志文件的路径及文件名 --> | |||
<file>${log.path}/log_error.log</file> | |||
<!--日志文件输出格式--> | |||
<encoder> | |||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
</encoder> | |||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
<maxFileSize>100MB</maxFileSize> | |||
</timeBasedFileNamingAndTriggeringPolicy> | |||
<!--日志文件保留天数--> | |||
<maxHistory>15</maxHistory> | |||
</rollingPolicy> | |||
<!-- 此日志文件只记录ERROR级别的 --> | |||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
<level>ERROR</level> | |||
<onMatch>ACCEPT</onMatch> | |||
<onMismatch>DENY</onMismatch> | |||
</filter> | |||
</appender> | |||
<!-- | |||
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、 | |||
以及指定<appender>。<logger>仅有一个name属性, | |||
一个可选的level和一个可选的addtivity属性。 | |||
name:用来指定受此logger约束的某一个包或者具体的某一个类。 | |||
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, | |||
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。 | |||
如果未设置此属性,那么当前logger将会继承上级的级别。 | |||
addtivity:是否向上级logger传递打印信息。默认是true。 | |||
--> | |||
<!--<logger name="org.springframework.web" level="info"/>--> | |||
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>--> | |||
<!-- | |||
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: | |||
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 | |||
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: | |||
--> | |||
<!-- | |||
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 | |||
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, | |||
不能设置为INHERITED或者同义词NULL。默认是DEBUG | |||
可以包含零个或多个元素,标识这个appender将会添加到这个logger。 | |||
--> | |||
<!--开发环境:打印控制台--> | |||
<springProfile name="dev"> | |||
<logger name="com.telpo.rzladapter" level="debug"/> | |||
</springProfile> | |||
<root level="info"> | |||
<appender-ref ref="CONSOLE"/> | |||
<appender-ref ref="DEBUG_FILE"/> | |||
<appender-ref ref="INFO_FILE"/> | |||
<appender-ref ref="WARN_FILE"/> | |||
<appender-ref ref="ERROR_FILE"/> | |||
</root> | |||
<!--生产环境:输出到文件--> | |||
<!--<springProfile name="pro">--> | |||
<!--<root level="info">--> | |||
<!--<appender-ref ref="CONSOLE" />--> | |||
<!--<appender-ref ref="DEBUG_FILE" />--> | |||
<!--<appender-ref ref="INFO_FILE" />--> | |||
<!--<appender-ref ref="ERROR_FILE" />--> | |||
<!--<appender-ref ref="WARN_FILE" />--> | |||
<!--</root>--> | |||
<!--</springProfile>--> | |||
</configuration> |