logback spring boot profile config

logback-spring.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds">

<property name="LOG_FILE" value="test.log" />
<springProfile name="dev">
<property name="LOG_HOME" value="${user.dir}/logs" />
</springProfile>
<springProfile name="test">
<property name="LOG_HOME" value="/root/app/apache-tomcat-8.5.30/logs" />
</springProfile>
<springProfile name="prod">
<property name="LOG_HOME" value="I:/apache-tomcat-8.5.28/logs" />
</springProfile>

<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<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="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>utf8</charset>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>

<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_HOME}/${LOG_FILE}</File>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${LOG_HOME}/${LOG_FILE}.%d{yyyy-MM-dd}.log.%i.gz</fileNamePattern>
<!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB -->
<maxFileSize>100MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>20GB</totalSizeCap>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>

<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<charset>utf8</charset>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>


<logger name="jdbc.sqlonly" level="WARN"/>
<logger name="jdbc.sqltiming" level="INFO"/>
<logger name="jdbc.resultsettable" level="INFO"/>
<logger name="jdbc.resultset" level="WARN"/>
<logger name="jdbc.connection" level="WARN"/>
<logger name="jdbc.audit" level="WARN"/>
<logger name="druid.sql.Statement" level="debug" />

<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>

frp https 配置

各种原因吧需要调本地项目,选择了frp,开始以为https配置很简单,搞了好久没成功,网上有说的模糊,今天实验成功了,记录一下,server 端配置,测试环境centos7

frps配置

1
2
3
4
5
[common]
bind_port = 7000
vhost_http_port = 8080 # 不要改成80不然下面的用的nginx起不来
token = xxxxxx12341234
log_file = ./frps.log

编写frps.service

/usr/lib/systemd/system

1
2
3
4
5
6
7
8
9
10
11
12
13
[Unit]
Description=frps daemon
After=network.target

[Service]
Type=simple
ExecStart=/opt/frp_0.21.0_linux_amd64/frps -c /opt/frp_0.21.0_linux_amd64/frps.ini
Restart=always
RestartSec=1min
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

frps.service启动,停止命令

1
2
3
systemctl enable frps
systemctl start frps
systemctl stop frps

树莓派centos7-mimimal连接WiFi

#nmcli d命令查看网络情况
1
2
3
4
5
[root@centos-rpi3 ~]# nmcli d
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
wlan0 wifi disconnected --
lo loopback unmanaged --
#nmcli d wifi查看附近WiFi
1
2
3
4
[root@centos-rpi3 ~]# nmcli d wifi
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
501 Infra 5 54 Mbit/s 60 ▂▄▆_ WPA2
-- Infra 1 54 Mbit/s 20 ▂___ WPA2
#nmcli d wifi connect your-wifi-ssid password wifi-passwd 连接WiFi
1
2
3
4
5
6
[root@centos-rpi3 ~]# nmcli d wifi connect <your-wifi-ssid> password <wifi-passwd>
[root@centos-rpi3 ~]# nmcli d
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
wlan0 wifi connected <your-wifi-ssid>
lo loopback unmanaged --

树莓派3b+,CentOS-Userland-7-armv7hl-Minimal-1708-RaspberryPi3.img.xz测试
img下载:http://mirror.centos.org/altarch/7/isos/armhfp/