Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
0d2cf649
Commit
0d2cf649
authored
Aug 08, 2019
by
QIANGLU
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev'
parents
49ec78fd
6ae58b47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
MatrixLogListenerConfiguration.java
logger-starter/secoo-log-starter/src/main/java/com/secoo/mall/logs/config/MatrixLogListenerConfiguration.java
+7
-15
logback-secoo.xml
logger-starter/secoo-log-starter/src/main/resources/logback-secoo.xml
+0
-0
No files found.
logger-starter/secoo-log-starter/src/main/java/com/secoo/mall/logs/config/MatrixLogListenerConfiguration.java
View file @
0d2cf649
...
...
@@ -7,6 +7,7 @@ import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener;
import
com.ctrip.framework.apollo.spring.boot.ApolloAutoConfiguration
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.logging.LogLevel
;
import
org.springframework.boot.logging.LoggingSystem
;
...
...
@@ -22,7 +23,7 @@ import java.util.Set;
*/
@Configuration
@ConditionalOnClass
(
ApolloAutoConfiguration
.
class
)
public
class
MatrixLogListenerConfiguration
{
public
class
MatrixLogListenerConfiguration
implements
InitializingBean
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MatrixLogListenerConfiguration
.
class
);
...
...
@@ -40,11 +41,10 @@ public class MatrixLogListenerConfiguration {
refreshLoggingLevels
();
}
@PostConstruct
private
void
refreshLoggingLevels
()
{
Set
<
String
>
keyNames
=
config
.
getPropertyNames
();
for
(
String
key
:
keyNames
)
{
if
(
containsIgnoreCase
(
key
,
LOGGER_TAG
))
{
if
(
StringUtils
.
startsWithIgnoreCase
(
key
,
LOGGER_TAG
))
{
String
strLevel
=
config
.
getProperty
(
key
,
"info"
);
LogLevel
level
=
LogLevel
.
valueOf
(
strLevel
.
toUpperCase
());
loggingSystem
.
setLogLevel
(
key
.
replace
(
LOGGER_TAG
,
""
),
level
);
...
...
@@ -53,17 +53,9 @@ public class MatrixLogListenerConfiguration {
}
}
private
static
boolean
containsIgnoreCase
(
String
str
,
String
searchStr
)
{
if
(
StringUtils
.
isEmpty
(
str
)
||
StringUtils
.
isEmpty
(
searchStr
))
{
return
false
;
}
int
len
=
searchStr
.
length
();
int
max
=
str
.
length
()
-
len
;
for
(
int
i
=
0
;
i
<=
max
;
i
++)
{
if
(
str
.
regionMatches
(
true
,
i
,
searchStr
,
0
,
len
))
{
return
true
;
}
}
return
false
;
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
refreshLoggingLevels
();
}
}
logger-starter/secoo-log-starter/src/main/resources/logback-s
pring
.xml
→
logger-starter/secoo-log-starter/src/main/resources/logback-s
ecoo
.xml
View file @
0d2cf649
File moved
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