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
13076b87
Commit
13076b87
authored
Jun 17, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Order logger output by short classname
Fixes gh-1067
parent
82cacf4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
AutoConfigurationReportLoggingInitializer.java
...re/logging/AutoConfigurationReportLoggingInitializer.java
+26
-3
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializer.java
View file @
13076b87
...
@@ -16,6 +16,11 @@
...
@@ -16,6 +16,11 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
logging
;
package
org
.
springframework
.
boot
.
autoconfigure
.
logging
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
...
@@ -117,7 +122,8 @@ public class AutoConfigurationReportLoggingInitializer implements
...
@@ -117,7 +122,8 @@ public class AutoConfigurationReportLoggingInitializer implements
message
.
append
(
"=========================\n\n\n"
);
message
.
append
(
"=========================\n\n\n"
);
message
.
append
(
"Positive matches:\n"
);
message
.
append
(
"Positive matches:\n"
);
message
.
append
(
"-----------------\n"
);
message
.
append
(
"-----------------\n"
);
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
outcomes
.
entrySet
())
{
Map
<
String
,
ConditionAndOutcomes
>
shortOutcomes
=
orderByName
(
outcomes
);
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
shortOutcomes
.
entrySet
())
{
if
(
entry
.
getValue
().
isFullMatch
())
{
if
(
entry
.
getValue
().
isFullMatch
())
{
addLogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
addLogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
}
}
...
@@ -125,7 +131,7 @@ public class AutoConfigurationReportLoggingInitializer implements
...
@@ -125,7 +131,7 @@ public class AutoConfigurationReportLoggingInitializer implements
message
.
append
(
"\n\n"
);
message
.
append
(
"\n\n"
);
message
.
append
(
"Negative matches:\n"
);
message
.
append
(
"Negative matches:\n"
);
message
.
append
(
"-----------------\n"
);
message
.
append
(
"-----------------\n"
);
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
o
utcomes
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
shortO
utcomes
.
entrySet
())
{
if
(!
entry
.
getValue
().
isFullMatch
())
{
if
(!
entry
.
getValue
().
isFullMatch
())
{
addLogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
addLogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
}
}
...
@@ -134,9 +140,26 @@ public class AutoConfigurationReportLoggingInitializer implements
...
@@ -134,9 +140,26 @@ public class AutoConfigurationReportLoggingInitializer implements
return
message
;
return
message
;
}
}
private
Map
<
String
,
ConditionAndOutcomes
>
orderByName
(
Map
<
String
,
ConditionAndOutcomes
>
outcomes
)
{
Map
<
String
,
ConditionAndOutcomes
>
result
=
new
LinkedHashMap
<
String
,
ConditionAndOutcomes
>();
List
<
String
>
names
=
new
ArrayList
<
String
>();
Map
<
String
,
String
>
classNames
=
new
HashMap
<
String
,
String
>();
for
(
String
name
:
outcomes
.
keySet
())
{
String
shortName
=
ClassUtils
.
getShortName
(
name
);
names
.
add
(
shortName
);
classNames
.
put
(
shortName
,
name
);
}
Collections
.
sort
(
names
);
for
(
String
shortName
:
names
)
{
result
.
put
(
shortName
,
outcomes
.
get
(
classNames
.
get
(
shortName
)));
}
return
result
;
}
private
void
addLogMessage
(
StringBuilder
message
,
String
source
,
private
void
addLogMessage
(
StringBuilder
message
,
String
source
,
ConditionAndOutcomes
conditionAndOutcomes
)
{
ConditionAndOutcomes
conditionAndOutcomes
)
{
message
.
append
(
"\n "
+
ClassUtils
.
getShortName
(
source
)
+
"\n"
);
message
.
append
(
"\n "
+
source
+
"\n"
);
for
(
ConditionAndOutcome
conditionAndOutcome
:
conditionAndOutcomes
)
{
for
(
ConditionAndOutcome
conditionAndOutcome
:
conditionAndOutcomes
)
{
message
.
append
(
" - "
);
message
.
append
(
" - "
);
if
(
StringUtils
.
hasLength
(
conditionAndOutcome
.
getOutcome
().
getMessage
()))
{
if
(
StringUtils
.
hasLength
(
conditionAndOutcome
.
getOutcome
().
getMessage
()))
{
...
...
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