Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
recv_data_longhua
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3bffb04e
authored
Sep 23, 2020
by
zhangxk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
temp
1 parent
84352054
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
4 deletions
pom.xml
src/main/java/com/viontech/model/BaseModel.java
src/main/resources/application.yml
src/main/resources/logback-spring.xml
pom.xml
View file @
3bffb04
...
...
@@ -13,7 +13,7 @@
<version>
0.0.1-SNAPSHOT
</version>
<name>
recv_data_longhua
</name>
<description>
recv_data_longhua
</description>
<packaging>
w
ar
</packaging>
<packaging>
j
ar
</packaging>
<properties>
<java.version>
1.8
</java.version>
</properties>
...
...
src/main/java/com/viontech/model/BaseModel.java
View file @
3bffb04
...
...
@@ -75,8 +75,8 @@ public class BaseModel {
}
byteBuf
.
writeIntLE
(
toInt
(
deviceId
));
byteBuf
.
writeIntLE
(
toInt
(
length
));
byteBuf
.
writeInt
(
toInt
(
protocol
));
byteBuf
.
writeInt
(
toInt
(
flag
));
byteBuf
.
writeInt
LE
(
toInt
(
protocol
));
byteBuf
.
writeInt
LE
(
toInt
(
flag
));
if
(
data
!=
null
&&
data
.
length
>
0
)
{
byteBuf
.
writeBytes
(
data
);
}
...
...
src/main/resources/application.yml
View file @
3bffb04
...
...
@@ -7,4 +7,6 @@ spring:
time-zone
:
GMT+8
date-format
:
yyyy-MM-dd HH:mm:ss
server
:
port
:
30000
\ No newline at end of file
port
:
30000
servlet
:
context-path
:
/recv_data_longhua
\ No newline at end of file
src/main/resources/logback-spring.xml
0 → 100644
View file @
3bffb04
<?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" />-->
<contextName>
logback
</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property
name=
"log.path"
value=
"/root/recv_data_longhua/logs"
/>
<!--<property name="log.path" value="/home/vion/xinghe/recv_data_longhua/logs" />-->
<property
name=
"logData.path"
value=
"datalogs"
/>
<property
name=
"pattern"
value=
"[%d{yyyy-MM-dd HH:mm:ss.SSS,GMT+8}] [%-5level] [%thread] %logger{50} - %msg%n"
/>
<property
name=
"datapattern"
value=
"%msg%n"
/>
<!--输出到控制台-->
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
info
</level>
</filter>
<encoder>
<Pattern>
${pattern}
</Pattern>
<!-- 设置字符集 -->
</encoder>
</appender>
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender
name=
"DEBUG_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 正在记录的日志文件的路径及文件名 -->
<file>
${log.path}/log_debug.log
</file>
<!--日志文件输出格式-->
<encoder>
<Pattern>
${pattern}
</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.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
5
</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>
${pattern}
</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.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
5
</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>
${pattern}
</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.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
5
</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>
${pattern}
</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.gz
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
100MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>
5
</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<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>
</configuration>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment