Skip to content

Commit 6007a60

Browse files
🇨🇳 1.3.0.RELEASE shiro+jwt
1 parent 1e00051 commit 6007a60

File tree

3 files changed

+130
-1
lines changed

3 files changed

+130
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 更新日志 CHANGELOG
22

3-
## [V1.3.0-RELEASE]
3+
## [V1.3.0-RELEASE] 2019.10.05
44

55
### ⭐️ New Features
66

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright 2019-2029 geekidea(https://github.com/geekidea)
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
<configuration>
19+
20+
<property name="CONTEXT_NAME" value="spring-boot-plus"/>
21+
<property name="LOG_PATH" value="logs"/>
22+
<property name="MAX_FILE_SIZE" value="10MB"/>
23+
<property name="MAX_HISTORY" value="30"/>
24+
25+
<contextName>${CONTEXT_NAME}</contextName>
26+
27+
<!-- 彩色日志 -->
28+
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
29+
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
30+
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
31+
32+
<!-- 控制台日志样式 -->
33+
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} [%L] %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
34+
<!-- 文件日志样式 -->
35+
<property name="FILE_LOG_PATTERN" value="${FILE_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } [%t] %-40.40logger{39} %L : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
36+
37+
<!-- 禁用logback自身日志输出 -->
38+
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
39+
40+
<!-- 控制台 -->
41+
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
42+
<encoder>
43+
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
44+
</encoder>
45+
</appender>
46+
47+
<!-- 运行日志文件 -->
48+
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
49+
<encoder>
50+
<pattern>${FILE_LOG_PATTERN}</pattern>
51+
</encoder>
52+
<file>${LOG_PATH}/spring-boot-plus.log</file>
53+
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
54+
<fileNamePattern>${LOG_PATH}/spring-boot-plus-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
55+
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
56+
<maxHistory>${MAX_HISTORY}</maxHistory>
57+
</rollingPolicy>
58+
</appender>
59+
60+
<!-- 错误日志文件 -->
61+
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
62+
<encoder>
63+
<pattern>${FILE_LOG_PATTERN}</pattern>
64+
</encoder>
65+
<file>${LOG_PATH}/spring-boot-plus-error.log</file>
66+
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
67+
<fileNamePattern>${LOG_PATH}/spring-boot-plus-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
68+
<maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
69+
<maxHistory>${MAX_HISTORY}</maxHistory>
70+
</rollingPolicy>
71+
<filter class="ch.qos.logback.classic.filter.LevelFilter">
72+
<level>ERROR</level>
73+
<onMatch>ACCEPT</onMatch>
74+
<onMismatch>DENY</onMismatch>
75+
</filter>
76+
</appender>
77+
78+
<!-- 异步写日志 -->
79+
<appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
80+
<discardingThreshold>0</discardingThreshold>
81+
<queueSize>1024</queueSize>
82+
<appender-ref ref ="FILE"/>
83+
</appender>
84+
<appender name="ASYNC_ERROR_FILE" class="ch.qos.logback.classic.AsyncAppender">
85+
<discardingThreshold>0</discardingThreshold>
86+
<queueSize>1024</queueSize>
87+
<appender-ref ref ="ERROR_FILE"/>
88+
</appender>
89+
90+
91+
<!-- 不同环境的日志级别配置 -->
92+
<springProfile name="local">
93+
<logger name="io.geekidea.springbootplus" level="DEBUG"/>
94+
</springProfile>
95+
96+
<!-- 解决SpringBootAdmin错误日志问题 -->
97+
<!-- <logger name="org.apache.catalina.connector.CoyoteAdapter" level="OFF"/>-->
98+
99+
<root level="INFO">
100+
<appender-ref ref="CONSOLE" />
101+
<appender-ref ref="ASYNC_FILE" />
102+
<appender-ref ref="ASYNC_ERROR_FILE" />
103+
</root>
104+
105+
</configuration>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.geekidea.springbootplus.test;
2+
3+
import org.junit.Test;
4+
import org.junit.runner.RunWith;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.data.redis.core.RedisTemplate;
8+
import org.springframework.test.context.junit4.SpringRunner;
9+
10+
@RunWith(SpringRunner.class)
11+
@SpringBootTest
12+
public class RedisTemplateTest {
13+
14+
@Autowired
15+
private RedisTemplate redisTemplate;
16+
17+
@Test
18+
public void put(){
19+
redisTemplate.opsForHash().increment("hello","world",1);
20+
System.out.println(redisTemplate.opsForHash().get("hello","world"));
21+
redisTemplate.opsForHash().increment("hello","world",-1);
22+
System.out.println(redisTemplate.opsForHash().get("hello","world"));
23+
}
24+
}

0 commit comments

Comments
 (0)