Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e746edb8
authored
Dec 06, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat: logback问题
parent
f92d1460
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
166 deletions
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-web/src/main/resources/application-dev.yml
server-web/src/main/resources/application-test.yml
server-web/src/main/resources/logback-spring-test.xml
server-web/src/main/resources/logback-spring.xml
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
e746edb8
...
@@ -30,6 +30,7 @@ import org.springframework.scheduling.annotation.Async;
...
@@ -30,6 +30,7 @@ import org.springframework.scheduling.annotation.Async;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StopWatch
;
import
org.springframework.util.StopWatch
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
...
@@ -221,7 +222,8 @@ public class PushCallback implements MqttCallback {
...
@@ -221,7 +222,8 @@ public class PushCallback implements MqttCallback {
redisTemplate
.
opsForValue
().
set
(
SLEEP_ANALYSIS_KEY
,
analysisModel
.
getSleepTimeActionDuration
(),
1
,
TimeUnit
.
DAYS
);
redisTemplate
.
opsForValue
().
set
(
SLEEP_ANALYSIS_KEY
,
analysisModel
.
getSleepTimeActionDuration
(),
1
,
TimeUnit
.
DAYS
);
sleepTimeActionDuration
=
analysisModel
.
getSleepTimeActionDuration
();
sleepTimeActionDuration
=
analysisModel
.
getSleepTimeActionDuration
();
}
}
return
Long
.
parseLong
(
sleepTimeActionDuration
)
*
60
;
BigDecimal
s
=
new
BigDecimal
(
sleepTimeActionDuration
).
multiply
(
new
BigDecimal
(
60
));
return
s
.
longValue
();
}
}
...
...
server-web/src/main/resources/application-dev.yml
View file @
e746edb8
...
@@ -62,10 +62,6 @@ mybatis-plus:
...
@@ -62,10 +62,6 @@ mybatis-plus:
configuration
:
configuration
:
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
logging
:
level
:
root
:
debug
file
:
file
:
filePath
:
file
filePath
:
file
...
@@ -128,7 +124,7 @@ mqtt:
...
@@ -128,7 +124,7 @@ mqtt:
defaultTopic
:
/device/*/*/**
defaultTopic
:
/device/*/*/**
timeout
:
10
timeout
:
10
keepalive
:
60
keepalive
:
60
msgSwitch
:
fals
e
msgSwitch
:
tru
e
wx
:
wx
:
miniapp
:
miniapp
:
...
...
server-web/src/main/resources/application-test.yml
View file @
e746edb8
...
@@ -69,6 +69,11 @@ storage:
...
@@ -69,6 +69,11 @@ storage:
type
:
local
type
:
local
url
:
https://saas.qa.insightica.cn/api/${file.filePath}
url
:
https://saas.qa.insightica.cn/api/${file.filePath}
logging
:
level
:
root
:
info
config
:
classpath:logback-spring-test.xml
# aliBaseDir: point
# aliBaseDir: point
# aliEndpoint: obs.cn-south-1.myhuaweicloud.com
# aliEndpoint: obs.cn-south-1.myhuaweicloud.com
# aliAccessKeyId: HY7KT4GKCOGSRCHLXBAR
# aliAccessKeyId: HY7KT4GKCOGSRCHLXBAR
...
...
server-web/src/main/resources/logback-spring-test.xml
View file @
e746edb8
This diff is collapsed.
Click to expand it.
server-web/src/main/resources/logback-spring.xml
deleted
100644 → 0
View file @
f92d1460
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"logback.logdir"
value=
"/opt/iot-platform-server/logs"
/>
<property
name=
"logback.appname"
value=
"app"
/>
<property
name=
"pattern"
value=
"%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{appName}] [%X{profile}] [%X{traceId:-},%X{spanId:-}] [%X{requestId}] [%X{userId}] [%thread] %-5level %logger{50} - %msg%n"
/>
<springProfile
name=
"prod"
>
<property
name=
"logback.logdir"
value=
"/home/group1_lzy/iot-server/logs"
/>
<property
name=
"logback.appname"
value=
"app"
/>
</springProfile>
<springProfile
name=
"test"
>
<property
name=
"logback.logdir"
value=
"/home/group1_lzy/iot-server/logs"
/>
<property
name=
"logback.appname"
value=
"app"
/>
</springProfile>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
DEBUG
</level>
</filter>
<encoder>
<pattern>
${pattern}
</pattern>
</encoder>
</appender>
<!-- info -->
<appender
name=
"FILELOGGING"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
INFO
</level>
</filter>
<file>
${logback.logdir}/${logback.appname}/logging/logging.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${logback.logdir}/${logback.appname}/logging/logging.%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<maxHistory>
30
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
20MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
${pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
</appender>
<!-- info -->
<appender
name=
"FILEINFOLOG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
INFO
</level>
</filter>
<file>
${logback.logdir}/${logback.appname}/info/log_info.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${logback.logdir}/${logback.appname}/info/log_info.%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<maxHistory>
30
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
20MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
${pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
</appender>
<!-- error -->
<appender
name=
"FILEERRORLOG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
ERROR
</level>
</filter>
<file>
${logback.logdir}/${logback.appname}/error/log_error.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${logback.logdir}/${logback.appname}/error/log_error.%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<maxHistory>
30
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
20MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
${pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
</appender>
<!-- WARN -->
<appender
name=
"FILEWARNLOG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
WARN
</level>
</filter>
<file>
${logback.logdir}/${logback.appname}/warn/log_warn.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${logback.logdir}/${logback.appname}/warn/log_warn.%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<maxHistory>
30
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
20MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
${pattern}
</pattern>
<charset>
UTF-8
</charset>
</encoder>
</appender>
<springProfile
name=
"dev"
>
<root
level=
"INFO"
>
<appender-ref
ref=
"FILEINFOLOG"
/>
<appender-ref
ref=
"FILEERRORLOG"
/>
<appender-ref
ref=
"FILEWARNLOG"
/>
</root>
<logger
name=
"com.makeit"
level=
"DEBUG"
additivity=
"false"
>
<appender-ref
ref=
"FILEINFOLOG"
/>
<appender-ref
ref=
"FILEERRORLOG"
/>
<appender-ref
ref=
"FILEWARNLOG"
/>
</logger>
</springProfile>
<springProfile
name=
"test"
>
<root
level=
"INFO"
>
<appender-ref
ref=
"FILEINFOLOG"
/>
<appender-ref
ref=
"FILEERRORLOG"
/>
<appender-ref
ref=
"FILEWARNLOG"
/>
</root>
<logger
name=
"com.makeit"
level=
"DEBUG"
additivity=
"false"
>
<appender-ref
ref=
"FILEINFOLOG"
/>
<appender-ref
ref=
"FILEERRORLOG"
/>
<appender-ref
ref=
"FILEWARNLOG"
/>
</logger>
</springProfile>
<springProfile
name=
"prod"
>
<property
name=
"logback.logdir"
value=
"/home/project/jianfa-integral/logs"
/>
<property
name=
"logback.appname"
value=
"app"
/>
<root
level=
"INFO"
>
<appender-ref
ref=
"FILEINFOLOG"
/>
<appender-ref
ref=
"FILEERRORLOG"
/>
<appender-ref
ref=
"FILEWARNLOG"
/>
</root>
<logger
name=
"com.makeit"
level=
"DEBUG"
additivity=
"false"
>
<appender-ref
ref=
"FILEINFOLOG"
/>
<appender-ref
ref=
"FILEERRORLOG"
/>
<appender-ref
ref=
"FILEWARNLOG"
/>
</logger>
</springProfile>
</configuration>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment