Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
c3430d58
Commit
c3430d58
authored
Feb 22, 2019
by
Dmytro Nosan
Committed by
Stephane Nicoll
Feb 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug mode is not logging web and sql related loggers
See gh-16018
parent
130ef102
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
LoggingApplicationListener.java
...work/boot/context/logging/LoggingApplicationListener.java
+7
-7
LoggingApplicationListenerTests.java
...boot/context/logging/LoggingApplicationListenerTests.java
+16
-1
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
View file @
c3430d58
/*
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,6 +21,7 @@ import java.util.LinkedHashMap;
...
@@ -21,6 +21,7 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
...
@@ -320,12 +321,11 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -320,12 +321,11 @@ public class LoggingApplicationListener implements GenericApplicationListener {
}
}
protected
void
initializeLogLevel
(
LoggingSystem
system
,
LogLevel
level
)
{
protected
void
initializeLogLevel
(
LoggingSystem
system
,
LogLevel
level
)
{
List
<
String
>
loggers
=
LOG_LEVEL_LOGGERS
.
get
(
level
);
Optional
.
ofNullable
(
LOG_LEVEL_LOGGERS
.
get
(
level
)).
orElse
(
Collections
.
emptyList
())
if
(
loggers
!=
null
)
{
.
stream
()
for
(
String
logger
:
loggers
)
{
.
flatMap
((
logger
)
->
DEFAULT_GROUP_LOGGERS
system
.
setLogLevel
(
logger
,
level
);
.
getOrDefault
(
logger
,
Collections
.
singletonList
(
logger
)).
stream
())
}
.
forEach
((
logger
)
->
system
.
setLogLevel
(
logger
,
level
));
}
}
}
protected
void
setLogLevels
(
LoggingSystem
system
,
Environment
environment
)
{
protected
void
setLogLevels
(
LoggingSystem
system
,
Environment
environment
)
{
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java
View file @
c3430d58
/*
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -262,6 +262,21 @@ public class LoggingApplicationListenerTests {
...
@@ -262,6 +262,21 @@ public class LoggingApplicationListenerTests {
assertThat
(
this
.
outputCapture
.
toString
()).
doesNotContain
(
"testattrace"
);
assertThat
(
this
.
outputCapture
.
toString
()).
doesNotContain
(
"testattrace"
);
}
}
@Test
public
void
parseDebugArgExpandGroups
()
{
addPropertiesToEnvironment
(
this
.
context
,
"debug"
);
this
.
initializer
.
initialize
(
this
.
context
.
getEnvironment
(),
this
.
context
.
getClassLoader
());
ch
.
qos
.
logback
.
classic
.
Logger
sqlGroup
=
this
.
loggerContext
.
getLogger
(
"org.hibernate.SQL"
);
ch
.
qos
.
logback
.
classic
.
Logger
webGroup
=
this
.
loggerContext
.
getLogger
(
"org.springframework.boot.actuate.endpoint.web"
);
webGroup
.
debug
(
"testdebugwebgroup"
);
sqlGroup
.
debug
(
"testdebugsqlgroup"
);
assertThat
(
this
.
outputCapture
.
toString
()).
contains
(
"testdebugwebgroup"
);
assertThat
(
this
.
outputCapture
.
toString
()).
contains
(
"testdebugsqlgroup"
);
}
@Test
@Test
public
void
parseTraceArg
()
{
public
void
parseTraceArg
()
{
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
context
,
"trace"
);
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
context
,
"trace"
);
...
...
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