Commit 379ceca22aec5c4b2b6c9d00528ec9439af68724
1 parent
79306e34
配置多环境 使用插件选择dev || Pro 打包
Showing
7 changed files
with
337 additions
and
39 deletions
pom.xml
| ... | ... | @@ -194,6 +194,19 @@ |
| 194 | 194 | </dependencies> |
| 195 | 195 | |
| 196 | 196 | <build> |
| 197 | + <resources> | |
| 198 | + <resource> | |
| 199 | + <!-- 指定配置文件所在的resource目录 --> | |
| 200 | + <directory>src/main/resources</directory> | |
| 201 | + <includes> | |
| 202 | + <include>application.properties</include> | |
| 203 | + <include>application-${environment}.properties</include> | |
| 204 | + <include>logback-${environment}.xml</include> | |
| 205 | + </includes> | |
| 206 | + <filtering>true</filtering> | |
| 207 | + </resource> | |
| 208 | + </resources> | |
| 209 | + <!-- 指定打包名称--> | |
| 197 | 210 | <finalName>cnlive_shenhe_test-0.0.1-SNAPSHOT</finalName> |
| 198 | 211 | <plugins> |
| 199 | 212 | <plugin> |
| ... | ... | @@ -227,5 +240,28 @@ |
| 227 | 240 | </plugins> |
| 228 | 241 | </build> |
| 229 | 242 | |
| 243 | + <!--分别设置开发,测试,生产环境--> | |
| 244 | + <profiles> | |
| 245 | + <!-- 开发环境 --> | |
| 246 | + <profile> | |
| 247 | + <id>dev</id> | |
| 248 | + <activation> | |
| 249 | + <activeByDefault>true</activeByDefault> | |
| 250 | + </activation> | |
| 251 | + <properties> | |
| 252 | + <environment>dev</environment> | |
| 253 | + </properties> | |
| 254 | + </profile> | |
| 255 | + <!-- 生产环境 --> | |
| 256 | + <profile> | |
| 257 | + <id>pro</id> | |
| 258 | + <activation> | |
| 259 | + <activeByDefault>false</activeByDefault> | |
| 260 | + </activation> | |
| 261 | + <properties> | |
| 262 | + <environment>pro</environment> | |
| 263 | + </properties> | |
| 264 | + </profile> | |
| 265 | + </profiles> | |
| 230 | 266 | |
| 231 | 267 | </project> | ... | ... |
src/main/resources/application-dev.properties
0 → 100644
| 1 | +server.port=82 | |
| 2 | + | |
| 3 | +spring.datasource.url=jdbc:mysql://120.92.102.31:3306/new_shy?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false | |
| 4 | +spring.datasource.username=root | |
| 5 | +spring.datasource.password=M345sdfss4! | |
| 6 | + | |
| 7 | +logging.config=classpath:logback-dev.xml | |
| 8 | + | |
| 9 | +#logback\u65e5\u5fd7\u4e2d\u4f7f\u7528 | |
| 10 | +spring.application.name=cnlive_shenhe_test | |
| 11 | +spring.application.home=/usr/local/test_cnlive_shenhe/cnlive_shenhe/log | |
| 12 | + | |
| 13 | +#\u672c\u673a\u5730\u5740 | |
| 14 | +spring.localhost.url=http://test.shen.cnlive.com | |
| 15 | + | |
| 16 | +#\u62bd\u5e27\u5e38\u91cf | |
| 17 | +avsmple_url=http://test.transcode.cnlive.com/api/request | |
| 18 | +avsmple_callback=http://test.shen.cnlive.com/api/avsample/callback | |
| 19 | + | |
| 20 | +#\u540c\u6b65\u76f4\u64ad\u4e91\u4fe1\u606f | |
| 21 | +live_url=http://test.bc.cnlive.com/bokong/activity/activityShenHe | |
| 22 | + | |
| 23 | +#\u62bd\u5e27\u5b58\u653ebucket\u548c\u57df\u540d | |
| 24 | +qn_bucket=cnlivetest | |
| 25 | +qn_domain=http://test.qnvod.cnlive.com | |
| 26 | +ks_bucket=cnlive-test | |
| 27 | +ks_domain=http://test.wideo.cnlive.com | |
| 28 | + | |
| 29 | +#\u56fe\u7247\u5b58\u653e\u6839\u8def\u5f84 | |
| 30 | +yiDun_audio_callback=http://test.shen.cnlive.com/api/audio/callbackAudio | |
| 0 | 31 | \ No newline at end of file | ... | ... |
src/main/resources/application-pro.properties
0 → 100644
| 1 | +server.port=81 | |
| 2 | + | |
| 3 | +spring.datasource.url=jdbc:mysql://10.137.192.7:3306/new_shy?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false | |
| 4 | +spring.datasource.username=admin | |
| 5 | +spring.datasource.password=83BwiCoq | |
| 6 | + | |
| 7 | +logging.config=classpath:logback-pro.xml | |
| 8 | + | |
| 9 | +#logback\u65e5\u5fd7\u4e2d\u4f7f\u7528 | |
| 10 | +spring.application.name=cnlive_shenhe | |
| 11 | +spring.application.home=/usr/local/cnlive_shenhe/log | |
| 12 | + | |
| 13 | +#\u672c\u673a\u5730\u5740 | |
| 14 | +spring.localhost.url=http://shen.cnlive.com | |
| 15 | + | |
| 16 | +#\u62bd\u5e27\u5e38\u91cf | |
| 17 | +avsmple_url=http://transcode.cnlive.com/api/request | |
| 18 | +avsmple_callback=http://shen.cnlive.com/api/avsample/callback | |
| 19 | + | |
| 20 | +#\u540c\u6b65\u76f4\u64ad\u4e91\u4fe1\u606f | |
| 21 | +live_url=http://bc.cnlive.com/bokong/activity/activityShenHe | |
| 22 | + | |
| 23 | +#\u62bd\u5e27\u5b58\u653ebucket\u548c\u57df\u540d | |
| 24 | +qn_bucket=mam-sxzg-82 | |
| 25 | +qn_domain=http://sxzg.ys2.cnliveimg.com | |
| 26 | +ks_bucket=mam-sxzg-82 | |
| 27 | +ks_domain=http://sxzg.ys1.cnliveimg.com | |
| 28 | + | |
| 29 | +#\u56fe\u7247\u5b58\u653e\u6839\u8def\u5f84 | ... | ... |
src/main/resources/application.properties
| 1 | -spring.datasource.url=jdbc:mysql://120.92.102.31:3306/new_shy?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false | |
| 2 | -spring.datasource.username=root | |
| 3 | -spring.datasource.password=M345sdfss4! | |
| 1 | +spring.profiles.active=@environment@ | |
| 4 | 2 | |
| 5 | 3 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
| 6 | 4 | |
| ... | ... | @@ -20,41 +18,27 @@ spring.thymeleaf.mode=LEGACYHTML5 |
| 20 | 18 | spring.thymeleaf.cache=false |
| 21 | 19 | #spring.thymeleaf.encoding=UTF-8 |
| 22 | 20 | #spring.thymeleaf.content-type=text/html |
| 23 | -#\u5F00\u53D1\u65F6\u5173\u95ED\u7F13\u5B58,\u4E0D\u7136\u6CA1\u6CD5\u770B\u5230\u5B9E\u65F6\u9875\u9762 | |
| 24 | - | |
| 25 | -#\u6253\u5370\u8FD0\u884C\u65F6\u7684sql | |
| 26 | -#logging.level.com.cnlive.shenhe.mapper=debug | |
| 27 | 21 | |
| 28 | 22 | mybatis.mapper-locations=classpath:mapper/*.xml |
| 29 | 23 | mybatis.type-aliases-package=com.cnlive.shenhe.entity |
| 30 | -server.port=82 | |
| 31 | 24 | |
| 32 | 25 | #rabbitmq\u76F8\u5173\u914D\u7F6E |
| 33 | 26 | spring.rabbitmq.host=10.254.174.131 |
| 34 | 27 | spring.rabbitmq.port=5672 |
| 35 | 28 | spring.rabbitmq.username=test |
| 36 | 29 | spring.rabbitmq.password=p3~amKKt9 |
| 37 | -# \u5F00\u542F\u53D1\u9001\u786E\u8BA4 | |
| 30 | + | |
| 38 | 31 | spring.rabbitmq.publisher-confirms=true |
| 39 | -# \u5F00\u542F\u53D1\u9001\u5931\u8D25\u9000\u56DE | |
| 40 | 32 | spring.rabbitmq.publisher-returns=true |
| 41 | -# \u5F00\u542FACK | |
| 42 | 33 | spring.rabbitmq.listener.direct.acknowledge-mode=manual |
| 43 | 34 | spring.rabbitmq.listener.simple.acknowledge-mode=manual |
| 44 | 35 | |
| 45 | -#\u8BDD\u9898\u8BC4\u8BBA\u5206\u4EABh5 | |
| 46 | -#topic_comment_shareH5=http://wjjh5test.cnlive.com/cnShareTopic.html?tid= | |
| 47 | - | |
| 48 | 36 | #\u5173\u95EDspringboot\u63D0\u4F9B\u7684\u9ED8\u8BA4ico |
| 49 | 37 | spring.mvc.favicon.enabled = false |
| 50 | 38 | |
| 51 | 39 | #\u8BC4\u8BBA\u7981\u8A00\u548C\u89E3\u7981\u4F7F\u7528API |
| 52 | 40 | speak_comment=http://comment.cnlive.com/services/commentForTopic/muted |
| 53 | 41 | |
| 54 | -#logback\u65E5\u5FD7\u4E2D\u4F7F\u7528 | |
| 55 | -spring.application.name=cnlive_shenhe_test | |
| 56 | -spring.application.home=/usr/local/test_cnlive_shenhe/cnlive_shenhe/log | |
| 57 | - | |
| 58 | 42 | sync_users_api=http://api.cnlive.com/open/api2/inner2/shenhe/getuser |
| 59 | 43 | sync_users_app_key=314a9dd4-a9b7-4c12-bbbe-1150a36491ae |
| 60 | 44 | |
| ... | ... | @@ -67,35 +51,16 @@ url=http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify |
| 67 | 51 | platformKey =AUDIT |
| 68 | 52 | platformValue=10011438 |
| 69 | 53 | |
| 70 | -#\u672C\u673A\u5730\u5740 | |
| 71 | -spring.localhost.url=http://test.shen.cnlive.com | |
| 72 | - | |
| 73 | 54 | #\u62BD\u5E27\u5E38\u91CF |
| 74 | 55 | avsmple_appKey=1eac30dfbee311e7a2f0fa163e771cf9 |
| 75 | 56 | avsmple_appSecret=28ce1e1fbee311e7a2f0fa163e771cf92ea58ebfbee311e7a2f0fa163e771cf9 |
| 76 | -avsmple_url=http://test.transcode.cnlive.com/api/request | |
| 77 | -avsmple_callback=http://test.shen.cnlive.com/api/avsample/callback | |
| 78 | - | |
| 79 | -#\u540C\u6B65\u76F4\u64AD\u4E91\u4FE1\u606F | |
| 80 | -live_url=http://test.bc.cnlive.com/bokong/activity/activityShenHe | |
| 81 | 57 | |
| 82 | 58 | #\u90AE\u4EF6\u4F7F\u7528\u5E38\u91CF |
| 83 | 59 | email_app_id=769_jetja50p18 |
| 84 | 60 | email_app_key=ad101b9152817a79b5c33c3617b96ff91385096ff3b4ba |
| 85 | 61 | email_send_URL=http://sms.cnlive.com/CnliveM3/email/sendMoreVarEmail.action |
| 86 | 62 | |
| 87 | -#\u62BD\u5E27\u5B58\u653Ebucket\u548C\u57DF\u540D | |
| 88 | -qn_bucket=cnlivetest | |
| 89 | -qn_domain=http://test.qnvod.cnlive.com | |
| 90 | -ks_bucket=cnlive-test | |
| 91 | -ks_domain=http://test.wideo.cnlive.com | |
| 92 | - | |
| 93 | -#qn_bucket=mam-sxzg-82 | |
| 94 | -#qn_domain=http://sxzg.ys2.cnliveimg.com | |
| 95 | -#ks_bucket=mam-sxzg-82 | |
| 96 | -#ks_domain=http://sxzg.ys1.cnliveimg.com | |
| 97 | - | |
| 98 | 63 | #\u56FE\u7247\u5B58\u653E\u6839\u8DEF\u5F84 |
| 99 | 64 | desdir=shen |
| 100 | -yiDun_audio_callback=http://test.shen.cnlive.com/api/audio/ | |
| 101 | -cms_getVideoAndLiveId=http://cmstest.cnlive.com:8768/contentApi/getBeanByIdcallbackAudio | |
| 65 | +#yiDun_audio_callback=http://test.shen.cnlive.com/api/audio/ | |
| 66 | +#cms_getVideoAndLiveId=http://cmstest.cnlive.com:8768/contentApi/getBeanByIdcallbackAudio | ... | ... |
src/main/resources/logback-spring.xml renamed to src/main/resources/logback-dev.xml
src/main/resources/logback-pro.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!-- | |
| 3 | +scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。 | |
| 4 | +scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒当scan为true时,此属性生效。默认的时间间隔为1分钟。 | |
| 5 | +debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 | |
| 6 | +--> | |
| 7 | +<configuration scan="false" scanPeriod="60 seconds" debug="false"> | |
| 8 | + <!--日志文件主目录:这里${user.home}为当前服务器用户主目录--> | |
| 9 | +<!-- <property name="LOG_HOME" value="/usr/local/test_cnlive_shenhe/cnlive_shenhe/log" /> --> | |
| 10 | + <springProperty scope="context" name="LOG_HOME" source="spring.application.home"/> | |
| 11 | + <!-- 定义日志文件名称 --> | |
| 12 | +<!-- <property name="appName" value="appName" source="spring.application.name"></property> --> | |
| 13 | + <!--日志文件名称:这里spring.application.name表示工程名称--> | |
| 14 | + <springProperty scope="context" name="APP_NAME" source="spring.application.name"/> | |
| 15 | + <!-- ch.qos.logback.core.ConsoleAppender 表示控制台输出 --> | |
| 16 | + <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> | |
| 17 | + <!-- | |
| 18 | + 日志输出格式: | |
| 19 | + %d表示日期时间, | |
| 20 | + %thread表示线程名, | |
| 21 | + %-5level:级别从左显示5个字符宽度 | |
| 22 | + %logger{50} 表示logger名字最长50个字符,否则按照句点分割。 | |
| 23 | + %msg:日志消息, | |
| 24 | + %n是换行符 | |
| 25 | + --> | |
| 26 | + <layout class="ch.qos.logback.classic.PatternLayout"> | |
| 27 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |
| 28 | + </layout> | |
| 29 | + </appender> | |
| 30 | + | |
| 31 | + <!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 --> | |
| 32 | + <appender name="appLogAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 33 | + <!-- 指定日志文件的名称 --> | |
| 34 | +<!-- <file>${LOG_HOME}/%d{yyyyMMdd}/${APP_NAME}.log</file> --> | |
| 35 | + <!-- | |
| 36 | + 当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名 | |
| 37 | + TimeBasedRollingPolicy: 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动。 | |
| 38 | + --> | |
| 39 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 40 | + <!-- | |
| 41 | + 滚动时产生的文件的存放位置及文件名称 %d{yyyy-MM-dd}:按天进行日志滚动 | |
| 42 | + %i:当文件大小超过maxFileSize时,按照i进行文件滚动 | |
| 43 | + --> | |
| 44 | + <fileNamePattern>${LOG_HOME}/%d{yyyyMMdd}/${APP_NAME}.log</fileNamePattern> | |
| 45 | + <!-- | |
| 46 | + 可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件。假设设置每天滚动, | |
| 47 | + 且maxHistory是365,则只保存最近365天的文件,删除之前的旧文件。注意,删除旧文件是, | |
| 48 | + 那些为了归档而创建的目录也会被删除。 | |
| 49 | + --> | |
| 50 | + <MaxHistory>30</MaxHistory> | |
| 51 | + <!-- | |
| 52 | + 当日志文件超过maxFileSize指定的大小是,根据上面提到的%i进行日志文件滚动 注意此处配置SizeBasedTriggeringPolicy是无法实现按文件大小进行滚动的,必须配置timeBasedFileNamingAndTriggeringPolicy | |
| 53 | + --> | |
| 54 | +<!-- <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> --> | |
| 55 | +<!-- <maxFileSize>100MB</maxFileSize> --> | |
| 56 | +<!-- </timeBasedFileNamingAndTriggeringPolicy> --> | |
| 57 | + </rollingPolicy> | |
| 58 | + <!-- 日志输出格式: --> | |
| 59 | + <layout class="ch.qos.logback.classic.PatternLayout"> | |
| 60 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |
| 61 | + </layout> | |
| 62 | + </appender> | |
| 63 | + | |
| 64 | + <!-- | |
| 65 | + logger主要用于存放日志对象,也可以定义日志类型、级别 | |
| 66 | + name:表示匹配的logger类型前缀,也就是包的前半部分 | |
| 67 | + level:要记录的日志级别,包括 TRACE < DEBUG < INFO < WARN < ERROR | |
| 68 | + additivity:作用在于children-logger是否使用 rootLogger配置的appender进行输出, | |
| 69 | + false:表示只用当前logger的appender-ref,true: | |
| 70 | + 表示当前logger的appender-ref和rootLogger的appender-ref都有效 | |
| 71 | + --> | |
| 72 | + <!-- hibernate logger --> | |
| 73 | + <logger name="com.yuanqinnan" level="debug" /> | |
| 74 | + <!-- Spring framework logger --> | |
| 75 | + <logger name="org.springframework" level="debug" additivity="false"></logger> | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + <!-- | |
| 80 | + root与logger是父子关系,没有特别定义则默认为root,任何一个类只会和一个logger对应, | |
| 81 | + 要么是定义的logger,要么是root,判断的关键在于找到这个logger,然后判断这个logger的appender和level。 | |
| 82 | + --> | |
| 83 | + <root level="info"> | |
| 84 | + <appender-ref ref="stdout" /> | |
| 85 | + <appender-ref ref="appLogAppender" /> | |
| 86 | + </root> | |
| 87 | +</configuration> | |
| 0 | 88 | \ No newline at end of file | ... | ... |
src/main/resources/logback.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<configuration> | |
| 3 | + <!--<include resource="org/springframework/boot/logging/logback/base.xml"/>--> | |
| 4 | + <!-- 项目的appid --> | |
| 5 | + <property name="APP_ID" value="demo"/> | |
| 6 | + <property name="LOG_PATH" value="log"></property> | |
| 7 | + | |
| 8 | + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
| 9 | + <encoder> | |
| 10 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} - %msg %n</pattern> | |
| 11 | + </encoder> | |
| 12 | + </appender> | |
| 13 | + | |
| 14 | + <appender name="FILE_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 15 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |
| 16 | + <level>DEBUG</level> | |
| 17 | + </filter> | |
| 18 | + <file>${LOG_PATH}/${APP_ID}/access.log</file> | |
| 19 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 20 | + <fileNamePattern>${LOG_PATH}/${APP_ID}/access.log.%d{yyyy-MM-dd}.zip</fileNamePattern> | |
| 21 | + <!-- maxHistory配置了日志在服务器上面只存留十个备份 --> | |
| 22 | + <maxHistory>10</maxHistory> | |
| 23 | + </rollingPolicy> | |
| 24 | + <encoder> | |
| 25 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> | |
| 26 | + </encoder> | |
| 27 | + </appender> | |
| 28 | + | |
| 29 | + <appender name="FILE_DEBUG" | |
| 30 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 31 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |
| 32 | + <level>DEBUG</level> | |
| 33 | + <onMatch>ACCEPT</onMatch> | |
| 34 | + <onMismatch>DENY</onMismatch> | |
| 35 | + </filter> | |
| 36 | + <file>${LOG_PATH}/${APP_ID}/access_debug.log</file> | |
| 37 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 38 | + <fileNamePattern>${LOG_PATH}/${APP_ID}/access_debug.log.%d{yyyy-MM-dd}.zip</fileNamePattern> | |
| 39 | + <!-- maxHistory配置了日志在服务器上面只存留十个备份 --> | |
| 40 | + <maxHistory>10</maxHistory> | |
| 41 | + </rollingPolicy> | |
| 42 | + <encoder> | |
| 43 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> | |
| 44 | + </encoder> | |
| 45 | + </appender> | |
| 46 | + | |
| 47 | + <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 48 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |
| 49 | + <level>INFO</level> | |
| 50 | + <onMatch>ACCEPT</onMatch> | |
| 51 | + <onMismatch>DENY</onMismatch> | |
| 52 | + </filter> | |
| 53 | + <file>${LOG_PATH}/${APP_ID}/access_info.log</file> | |
| 54 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 55 | + <fileNamePattern>${LOG_PATH}/${APP_ID}/access_info.log.%d{yyyy-MM-dd}.zip</fileNamePattern> | |
| 56 | + <!-- maxHistory配置了日志在服务器上面只存留十个备份 --> | |
| 57 | + <maxHistory>10</maxHistory> | |
| 58 | + </rollingPolicy> | |
| 59 | + <encoder> | |
| 60 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> | |
| 61 | + </encoder> | |
| 62 | + </appender> | |
| 63 | + | |
| 64 | + <appender name="FILE_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 65 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |
| 66 | + <level>WARN</level> | |
| 67 | + <onMatch>ACCEPT</onMatch> | |
| 68 | + <onMismatch>DENY</onMismatch> | |
| 69 | + </filter> | |
| 70 | + <file>${LOG_PATH}/${APP_ID}/access_warn.log</file> | |
| 71 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 72 | + <fileNamePattern>${LOG_PATH}/${APP_ID}/access_warn.log.%d{yyyy-MM-dd}.zip</fileNamePattern> | |
| 73 | + <!-- maxHistory配置了日志在服务器上面只存留十个备份 --> | |
| 74 | + <maxHistory>10</maxHistory> | |
| 75 | + </rollingPolicy> | |
| 76 | + <encoder> | |
| 77 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> | |
| 78 | + </encoder> | |
| 79 | + </appender> | |
| 80 | + | |
| 81 | + <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 82 | + <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |
| 83 | + <level>ERROR</level> | |
| 84 | + <onMatch>ACCEPT</onMatch> | |
| 85 | + <onMismatch>DENY</onMismatch> | |
| 86 | + </filter> | |
| 87 | + <file>${LOG_PATH}/${APP_ID}/access_error.log</file> | |
| 88 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
| 89 | + <fileNamePattern>${LOG_PATH}/${APP_ID}/access_error.log.%d{yyyy-MM-dd}.zip</fileNamePattern> | |
| 90 | + <!-- maxHistory配置了日志在服务器上面只存留十个备份 --> | |
| 91 | + <maxHistory>10</maxHistory> | |
| 92 | + </rollingPolicy> | |
| 93 | + <encoder> | |
| 94 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} %-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> | |
| 95 | + </encoder> | |
| 96 | + </appender> | |
| 97 | + | |
| 98 | + | |
| 99 | + <appender name="ASYNC_LOG" class="ch.qos.logback.classic.AsyncAppender"> | |
| 100 | + <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> | |
| 101 | + <discardingThreshold>0</discardingThreshold> | |
| 102 | + <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> | |
| 103 | + <queueSize>512</queueSize> | |
| 104 | + <appender-ref ref="FILE_LOG"/> | |
| 105 | + </appender> | |
| 106 | + <appender name="ASYNC_LOG" class="ch.qos.logback.classic.AsyncAppender"> | |
| 107 | + <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> | |
| 108 | + <discardingThreshold>0</discardingThreshold> | |
| 109 | + <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> | |
| 110 | + <queueSize>512</queueSize> | |
| 111 | + <appender-ref ref="FILE_LOG"/> | |
| 112 | + </appender> | |
| 113 | + <appender name="ASYNC_LOG_DEBUG" class="ch.qos.logback.classic.AsyncAppender"> | |
| 114 | + <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> | |
| 115 | + <discardingThreshold>0</discardingThreshold> | |
| 116 | + <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> | |
| 117 | + <queueSize>512</queueSize> | |
| 118 | + <appender-ref ref="FILE_DEBUG"/> | |
| 119 | + </appender> | |
| 120 | + <appender name="ASYNC_LOG_INFO" class="ch.qos.logback.classic.AsyncAppender"> | |
| 121 | + <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> | |
| 122 | + <discardingThreshold>0</discardingThreshold> | |
| 123 | + <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> | |
| 124 | + <queueSize>512</queueSize> | |
| 125 | + <appender-ref ref="FILE_INFO"/> | |
| 126 | + </appender> | |
| 127 | + <appender name="ASYNC_LOG_WARN" class="ch.qos.logback.classic.AsyncAppender"> | |
| 128 | + <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> | |
| 129 | + <discardingThreshold>0</discardingThreshold> | |
| 130 | + <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> | |
| 131 | + <queueSize>512</queueSize> | |
| 132 | + <appender-ref ref="FILE_WARN"/> | |
| 133 | + </appender> | |
| 134 | + <appender name="ASYNC_LOG_ERROR" class="ch.qos.logback.classic.AsyncAppender"> | |
| 135 | + <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> | |
| 136 | + <discardingThreshold>0</discardingThreshold> | |
| 137 | + <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> | |
| 138 | + <queueSize>512</queueSize> | |
| 139 | + <appender-ref ref="FILE_ERROR"/> | |
| 140 | + </appender> | |
| 141 | + <root level="INFO"> | |
| 142 | + <!-- appender referenced after it is defined --> | |
| 143 | + <appender-ref ref="STDOUT"/> | |
| 144 | + <appender-ref ref="ASYNC_LOG"/> | |
| 145 | + <appender-ref ref="ASYNC_LOG_DEBUG"/> | |
| 146 | + <appender-ref ref="ASYNC_LOG_INFO"/> | |
| 147 | + <appender-ref ref="ASYNC_LOG_WARN"/> | |
| 148 | + <appender-ref ref="ASYNC_LOG_ERROR"/> | |
| 149 | + </root> | |
| 150 | + <logger name="org.springframework" level="INFO"/> | |
| 151 | +</configuration> | |
| 0 | 152 | \ No newline at end of file | ... | ... |