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
6746a0af
Commit
6746a0af
authored
Sep 10, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.2.x'
parents
77eec2e0
624350f4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
10 deletions
+37
-10
HibernateJpaAutoConfiguration.java
.../autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java
+3
-2
ServerProperties.java
...ingframework/boot/autoconfigure/web/ServerProperties.java
+1
-1
Slf4JLoggingSystem.java
.../org/springframework/boot/logging/Slf4JLoggingSystem.java
+3
-3
LogbackLoggingSystem.java
...gframework/boot/logging/logback/LogbackLoggingSystem.java
+18
-4
LogbackLoggingSystemTests.java
...ework/boot/logging/logback/LogbackLoggingSystemTests.java
+12
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java
View file @
6746a0af
...
@@ -146,8 +146,9 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
...
@@ -146,8 +146,9 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
vendorProperties
.
put
(
JTA_PLATFORM
,
new
SpringJtaPlatform
(
vendorProperties
.
put
(
JTA_PLATFORM
,
new
SpringJtaPlatform
(
jtaTransactionManager
));
jtaTransactionManager
));
}
}
catch
(
NoClassDefFoundError
ex
)
{
catch
(
LinkageError
ex
)
{
// Can happen if Hibernate 4.2 is used
// NoClassDefFoundError can happen if Hibernate 4.2 is used and some
// containers (e.g. JBoss EAP 6) wraps it in the superclass LinkageError
if
(!
isUsingJndi
())
{
if
(!
isUsingJndi
())
{
throw
new
IllegalStateException
(
"Unable to set Hibernate JTA "
throw
new
IllegalStateException
(
"Unable to set Hibernate JTA "
+
"platform, are you using the correct "
+
"platform, are you using the correct "
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
View file @
6746a0af
...
@@ -68,7 +68,7 @@ import org.springframework.util.StringUtils;
...
@@ -68,7 +68,7 @@ import org.springframework.util.StringUtils;
* @author Ivan Sopov
* @author Ivan Sopov
* @author Marcos Barbero
* @author Marcos Barbero
*/
*/
@ConfigurationProperties
(
prefix
=
"server"
,
ignoreUnknownFields
=
fals
e
)
@ConfigurationProperties
(
prefix
=
"server"
,
ignoreUnknownFields
=
tru
e
)
public
class
ServerProperties
implements
EmbeddedServletContainerCustomizer
,
Ordered
{
public
class
ServerProperties
implements
EmbeddedServletContainerCustomizer
,
Ordered
{
/**
/**
...
...
spring-boot/src/main/java/org/springframework/boot/logging/Slf4JLoggingSystem.java
View file @
6746a0af
...
@@ -46,7 +46,7 @@ public abstract class Slf4JLoggingSystem extends AbstractLoggingSystem {
...
@@ -46,7 +46,7 @@ public abstract class Slf4JLoggingSystem extends AbstractLoggingSystem {
private
void
configureJdkLoggingBridgeHandler
()
{
private
void
configureJdkLoggingBridgeHandler
()
{
try
{
try
{
if
(
bridgeHandlerIs
Available
())
{
if
(
isBridgeHandler
Available
())
{
removeJdkLoggingBridgeHandler
();
removeJdkLoggingBridgeHandler
();
SLF4JBridgeHandler
.
install
();
SLF4JBridgeHandler
.
install
();
}
}
...
@@ -56,13 +56,13 @@ public abstract class Slf4JLoggingSystem extends AbstractLoggingSystem {
...
@@ -56,13 +56,13 @@ public abstract class Slf4JLoggingSystem extends AbstractLoggingSystem {
}
}
}
}
pr
ivate
boolean
bridgeHandlerIs
Available
()
{
pr
otected
final
boolean
isBridgeHandler
Available
()
{
return
ClassUtils
.
isPresent
(
BRIDGE_HANDLER
,
getClassLoader
());
return
ClassUtils
.
isPresent
(
BRIDGE_HANDLER
,
getClassLoader
());
}
}
private
void
removeJdkLoggingBridgeHandler
()
{
private
void
removeJdkLoggingBridgeHandler
()
{
try
{
try
{
if
(
bridgeHandlerIs
Available
())
{
if
(
isBridgeHandler
Available
())
{
try
{
try
{
SLF4JBridgeHandler
.
removeHandlersForRootLogger
();
SLF4JBridgeHandler
.
removeHandlersForRootLogger
();
}
}
...
...
spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
View file @
6746a0af
...
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
...
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
import
ch.qos.logback.classic.Level
;
import
ch.qos.logback.classic.Level
;
import
ch.qos.logback.classic.LoggerContext
;
import
ch.qos.logback.classic.LoggerContext
;
import
ch.qos.logback.classic.joran.JoranConfigurator
;
import
ch.qos.logback.classic.joran.JoranConfigurator
;
import
ch.qos.logback.classic.jul.LevelChangePropagator
;
import
ch.qos.logback.classic.turbo.TurboFilter
;
import
ch.qos.logback.classic.turbo.TurboFilter
;
import
ch.qos.logback.classic.util.ContextInitializer
;
import
ch.qos.logback.classic.util.ContextInitializer
;
import
ch.qos.logback.core.joran.spi.JoranException
;
import
ch.qos.logback.core.joran.spi.JoranException
;
...
@@ -106,8 +107,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
...
@@ -106,8 +107,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
protected
void
loadDefaults
(
LoggingInitializationContext
initializationContext
,
protected
void
loadDefaults
(
LoggingInitializationContext
initializationContext
,
LogFile
logFile
)
{
LogFile
logFile
)
{
LoggerContext
context
=
getLoggerContext
();
LoggerContext
context
=
getLoggerContext
();
context
.
stop
();
stopAndReset
(
context
);
context
.
reset
();
LogbackConfigurator
configurator
=
new
LogbackConfigurator
(
context
);
LogbackConfigurator
configurator
=
new
LogbackConfigurator
(
context
);
new
DefaultLogbackConfiguration
(
initializationContext
,
logFile
)
new
DefaultLogbackConfiguration
(
initializationContext
,
logFile
)
.
apply
(
configurator
);
.
apply
(
configurator
);
...
@@ -121,8 +121,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
...
@@ -121,8 +121,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
logFile
.
applyToSystemProperties
();
logFile
.
applyToSystemProperties
();
}
}
LoggerContext
loggerContext
=
getLoggerContext
();
LoggerContext
loggerContext
=
getLoggerContext
();
loggerContext
.
stop
();
stopAndReset
(
loggerContext
);
loggerContext
.
reset
();
try
{
try
{
configureByResourceUrl
(
initializationContext
,
loggerContext
,
configureByResourceUrl
(
initializationContext
,
loggerContext
,
ResourceUtils
.
getURL
(
location
));
ResourceUtils
.
getURL
(
location
));
...
@@ -159,6 +158,21 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
...
@@ -159,6 +158,21 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
}
}
}
}
private
void
stopAndReset
(
LoggerContext
loggerContext
)
{
loggerContext
.
stop
();
loggerContext
.
reset
();
if
(
isBridgeHandlerAvailable
())
{
addLevelChangePropagator
(
loggerContext
);
}
}
private
void
addLevelChangePropagator
(
LoggerContext
loggerContext
)
{
LevelChangePropagator
levelChangePropagator
=
new
LevelChangePropagator
();
levelChangePropagator
.
setResetJUL
(
true
);
levelChangePropagator
.
setContext
(
loggerContext
);
loggerContext
.
addListener
(
levelChangePropagator
);
}
@Override
@Override
public
void
cleanUp
()
{
public
void
cleanUp
()
{
super
.
cleanUp
();
super
.
cleanUp
();
...
...
spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
View file @
6746a0af
...
@@ -170,6 +170,18 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
...
@@ -170,6 +170,18 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
assertTrue
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"Hello world"
));
assertTrue
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"Hello world"
));
}
}
@Test
public
void
loggingLevelIsPropagatedToJulI
()
{
this
.
loggingSystem
.
beforeInitialize
();
this
.
loggingSystem
.
initialize
(
null
,
null
);
this
.
loggingSystem
.
setLogLevel
(
getClass
().
getName
(),
LogLevel
.
DEBUG
);
java
.
util
.
logging
.
Logger
julLogger
=
java
.
util
.
logging
.
Logger
.
getLogger
(
getClass
().
getName
());
julLogger
.
fine
(
"Hello debug world"
);
String
output
=
this
.
output
.
toString
().
trim
();
assertTrue
(
"Wrong output:\n"
+
output
,
output
.
contains
(
"Hello debug world"
));
}
@Test
@Test
public
void
jbossLoggingIsConfiguredToUseSlf4j
()
{
public
void
jbossLoggingIsConfiguredToUseSlf4j
()
{
this
.
loggingSystem
.
beforeInitialize
();
this
.
loggingSystem
.
beforeInitialize
();
...
...
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