• springboot常用日志,配置,maven包


    <?xml version="1.0" encoding="UTF-8"?>
    <configuration debug="true">
    
        <contextName>logback</contextName>
        <property name="log.path" value="/log/wise.log"/>
    
        <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
            <encoder>
                <pattern>%d{yyyy-MM-dd HH:mm:ss} %level [%thread] %logger:%line - %msg%n</pattern>
            </encoder>
        </appender>
    
        <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${log.path}</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
            </rollingPolicy>
            <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
                <MaxFileSize>100MB</MaxFileSize>
            </triggeringPolicy>
    
            <encoder>
                <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
                </pattern>
            </encoder>
        </appender>
    
        <root level="INFO">
            <appender-ref ref="console"/>
            <appender-ref ref="file"/>
        </root>
    
    </configuration>
    server:
        #端口
        port: 8543
        timeout: 300000 #超时时间,毫秒。默认30秒
        tomcat:
            uri-encoding: UTF-8 #默认编码
            max-threads: 400 #同时处理的任务个数,默认值为200
            accept-count: 800 #当同时处理的任务个数达到max-threads后,允许的排队个数
            max-connections: 10000 #tomcat允许建立的socket连接数,默认10000
    
    spring:
        application:
            #应用名称,对应注册中心的serviceId
            name: wisekg
        #日志收集集成ELK
        logstash:
            #logstash地址
            destination: localhost:8006
        #json格式,处理日期类型
        jackson:
            date-format: yyyy-MM-dd HH:mm:ss
            time-zone: GMT+8
    #服务治理
    eureka:
        #客户端
        client:
            #健康检查
            healthcheck:
                #是否开启健康检查
                enabled: true
            #注册中心地址
            serviceUrl:
                #默认地址
                defaultZone: http://registry.microservice.dev3.fzyun.io/eureka/
        #实例配置
        instance:
            #发呆时间,即服务续约到期时间(缺省为90s)
            #Eureka服务器在接收到实例的最后一次发出的心跳后,需要等待多久才可以将此实例删除
            lease-expiration-duration-in-seconds: 9
            #表示eureka client发送心跳给server端的频率,默认为30 秒
            #如果在lease-expiration-duration-in-seconds后, server端没有收到client的心跳,则将摘除该instance
            #除此之外,如果该instance实现了HealthCheckCallback,并决定让自己unavailable的话,则该instance也不会接收到流量
            lease-renewal-interval-in-seconds: 3
            #指定用ip访问而不是用主机名
            prefer-ip-address: true
            #指定真实的ip地址
            ip-address: ${spring.cloud.client.ipAddress}
            #指定在注册中心Status列显示的信息
            instance-id: ${eureka.instance.ip-address}:${server.port}:${spring.application.name}
    
    #开启异常中心记录异常信息
    exception:
        center:
            open: true
    
    #feign配置
    feign:
        hystrix:
            #feign开启服务监控,容错保护
            enabled: true
    
    #服务保护配置
    hystrix:
        command:
            default:
                execution:
                    isolation:
                        thread:
                            #调用服务超时时间, 毫秒
                            timeoutInMilliseconds: ${server.timeout}
    
    #客户端负载均衡调用配置
    ribbon:
        #读取超时时间, 毫秒
        ReadTimeout: ${server.timeout}
        #调用服务超时时间, 毫秒
        ConnectTimeout: ${server.timeout}
    
    logging:
      config: classpath:logback.xml
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             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.founder</groupId>
        <artifactId>wisekg</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>jar</packaging>
    
        <name>wisekg</name>
        <url>http://maven.apache.org</url>
        <!-- Spring Boot 启动父依赖 -->
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.4.RELEASE</version>
        </parent>
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
        </properties>
        <build>
            <pluginManagement><!-- lock down plugins versions to avoid using Maven
                    defaults (may be moved to parent pom) -->
                <plugins>
                    <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>3.1.0</version>
                    </plugin>
                    <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
    
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.8.0</version>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.0.2</version>
                    </plugin>
                    <plugin>
                        <artifactId>maven-install-plugin</artifactId>
                        <version>2.5.2</version>
                    </plugin>
                    <plugin>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>2.8.2</version>
                    </plugin>
                    <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
                    <plugin>
                        <artifactId>maven-site-plugin</artifactId>
                        <version>3.7.1</version>
                    </plugin>
                    <plugin>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                        <version>3.0.0</version>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.1</version>
                        <!--版本根据你自己的版本写 -->
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.2-beta-5</version>
                        <configuration>
                            <archive>
                                <manifest>
                                    <mainClass>com.founder.aiplatform.ProviderApplication</mainClass>
                                </manifest>
                            </archive>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                    </plugin>
    
                </plugins>
            </pluginManagement>
    
    
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <dependencies>
                        <dependency>
                            <groupId>org.springframework</groupId>
                            <artifactId>springloaded</artifactId>
                            <version>1.2.6.RELEASE</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.10</version>
                    <executions>
                        <execution>
                            <id>copy-dependencies</id>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
    
            </plugins>
    
        </build>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>3.8.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-eureka</artifactId>
                <version>1.3.1.RELEASE</version>
            </dependency>
    
            <dependency>
                <groupId>javax.mail</groupId>
                <artifactId>mail</artifactId>
                <version>1.4.5</version>
            </dependency>
    
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>1.1.33</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.3</version>
            </dependency>
    
            <dependency>
                <groupId>commons-net</groupId>
                <artifactId>commons-net</artifactId>
                <version>3.6</version>
            </dependency>
    
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.6</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.10</version>
            </dependency>
    
            <dependency>
                <groupId>commons-configuration</groupId>
                <artifactId>commons-configuration</artifactId>
                <version>1.9</version>
            </dependency>
    
            <dependency>
                <groupId>com.founder.wordsplit</groupId>
                <artifactId>wise-wordsplit</artifactId>
                <version>7.0.19</version>
            </dependency>
    
            <dependency>
                <groupId>org.jsoup</groupId>
                <artifactId>jsoup</artifactId>
                <version>1.12.1</version>
            </dependency>
    
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>1.1.6</version>
            </dependency>
    
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.27</version>
            </dependency>
        </dependencies>
    </project>
  • 相关阅读:
    mybatis 查询一对多子表只能查出一条数据
    Docker 查看容器里Log4写的日 志文 件里的日志
    MYSQL之union的使用
    【前端开发】常见好用的流程图框架
    【推荐】好网站推荐
    【前端工具】好用的数据库工具Navicat
    jQuery ajax
    thinkphp6.0封装数据库及缓存模型
    Unity 3D使用C#脚本实例
    Unity 3D简单使用C#脚本,脚本的执行顺序
  • 原文地址:https://www.cnblogs.com/dhName/p/14554608.html
Copyright © 2020-2023  润新知