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
d4b11c8f
Commit
d4b11c8f
authored
Sep 13, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to fix test failures on Java 9+
See gh-14453
parent
cef635d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
DevToolsLogFactory.java
...ingframework/boot/devtools/logger/DevToolsLogFactory.java
+13
-7
DeferredLog.java
...in/java/org/springframework/boot/logging/DeferredLog.java
+0
-4
No files found.
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/logger/DevToolsLogFactory.java
View file @
d4b11c8f
...
@@ -19,6 +19,8 @@ package org.springframework.boot.devtools.logger;
...
@@ -19,6 +19,8 @@ package org.springframework.boot.devtools.logger;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.springframework.boot.context.event.ApplicationPreparedEvent
;
import
org.springframework.boot.context.event.ApplicationPreparedEvent
;
import
org.springframework.boot.logging.DeferredLog
;
import
org.springframework.boot.logging.DeferredLog
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ApplicationListener
;
...
@@ -32,21 +34,21 @@ import org.springframework.data.domain.AbstractPageRequest;
...
@@ -32,21 +34,21 @@ import org.springframework.data.domain.AbstractPageRequest;
*/
*/
public
final
class
DevToolsLogFactory
{
public
final
class
DevToolsLogFactory
{
private
static
final
Map
<
Deferred
Log
,
Class
<?>>
logs
=
new
LinkedHashMap
<>();
private
static
final
Map
<
Log
,
Class
<?>>
logs
=
new
LinkedHashMap
<>();
private
DevToolsLogFactory
()
{
private
DevToolsLogFactory
()
{
}
}
/**
/**
* Get a {@link
DeferredLog} instance for the specified source that will be
* Get a {@link
Log} instance for the specified source that will be automatically
*
automatically {@link DeferredLog#switchTo(Class) switched} then the
*
{@link DeferredLog#switchTo(Class) switched} then the {@link AbstractPageRequest
*
{@link AbstractPageRequest
context is prepared}.
* context is prepared}.
* @param source the source for logging
* @param source the source for logging
* @return a {@link DeferredLog} instance
* @return a {@link DeferredLog} instance
*/
*/
public
static
Deferred
Log
getLog
(
Class
<?>
source
)
{
public
static
Log
getLog
(
Class
<?>
source
)
{
synchronized
(
logs
)
{
synchronized
(
logs
)
{
Deferred
Log
log
=
new
DeferredLog
();
Log
log
=
new
DeferredLog
();
logs
.
put
(
log
,
source
);
logs
.
put
(
log
,
source
);
return
log
;
return
log
;
}
}
...
@@ -60,7 +62,11 @@ public final class DevToolsLogFactory {
...
@@ -60,7 +62,11 @@ public final class DevToolsLogFactory {
@Override
@Override
public
void
onApplicationEvent
(
ApplicationPreparedEvent
event
)
{
public
void
onApplicationEvent
(
ApplicationPreparedEvent
event
)
{
synchronized
(
logs
)
{
synchronized
(
logs
)
{
logs
.
forEach
((
log
,
source
)
->
log
.
switchTo
(
source
));
logs
.
forEach
((
log
,
source
)
->
{
if
(
log
instanceof
DeferredLog
)
{
((
DeferredLog
)
log
).
switchTo
(
source
);
}
});
logs
.
clear
();
logs
.
clear
();
}
}
}
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java
View file @
d4b11c8f
...
@@ -192,9 +192,7 @@ public class DeferredLog implements Log {
...
@@ -192,9 +192,7 @@ public class DeferredLog implements Log {
* @param source the source logger
* @param source the source logger
* @param destination the destination logger class
* @param destination the destination logger class
* @return the destination
* @return the destination
* @deprecated since 2.1.0 in favor of {@link #switchTo(Class)}
*/
*/
@Deprecated
public
static
Log
replay
(
Log
source
,
Class
<?>
destination
)
{
public
static
Log
replay
(
Log
source
,
Class
<?>
destination
)
{
return
replay
(
source
,
LogFactory
.
getLog
(
destination
));
return
replay
(
source
,
LogFactory
.
getLog
(
destination
));
}
}
...
@@ -204,9 +202,7 @@ public class DeferredLog implements Log {
...
@@ -204,9 +202,7 @@ public class DeferredLog implements Log {
* @param source the source logger
* @param source the source logger
* @param destination the destination logger
* @param destination the destination logger
* @return the destination
* @return the destination
* @deprecated since 2.1.0 in favor of {@link #switchTo(Log)}
*/
*/
@Deprecated
public
static
Log
replay
(
Log
source
,
Log
destination
)
{
public
static
Log
replay
(
Log
source
,
Log
destination
)
{
if
(
source
instanceof
DeferredLog
)
{
if
(
source
instanceof
DeferredLog
)
{
((
DeferredLog
)
source
).
replayTo
(
destination
);
((
DeferredLog
)
source
).
replayTo
(
destination
);
...
...
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