Commit Graph

564 Commits

Author SHA1 Message Date
Andy Wilkinson
c857f957fa Correct syntax for thread name formatting in Logback XML configuration
See gh-2366
2015-01-20 11:51:54 +00:00
Dave Syer
b3597107ba More careful masking for the HTTP status in non-error cases
The ErrorPageFilter exposes a wrapped response to the downstream
chain and unless more care is taken the chain will be able to
set the response status, but not inspect it.

Fixes gh-2367
2015-01-16 11:29:00 +00:00
Andy Wilkinson
9744d28299 Uninstall SLF4J’s Java logging bridge handler during shutdown
Previously, when LogbackLoggingSystem or Log4JLoggingSystem were
initialized during application start up, they would install SLF4J’s Java
logging bridge handler, however no corresponding uninstall was performed
during application shutdown. When deployed to a servlet container, where
the application’s lifecycle doesn’t match the JVM’s lifecycle, this lead
to a memory leak.

This commit updates LoggingSystem to introduce a new cleanUp method. An
empty implementation is provided to preserve backwards compatibility
with existing LoggingSystem subclasses. Both LogbackLoggingSystem and
Log4JLoggingSystem have been updated to implement cleanUp and uninstall
the SLF4J bridge handler. LoggingApplicationListener has been updated
to call LoggingSystem.cleanUp in response to a ContextClosedEvent.

Closes gh-2324
2015-01-14 14:37:58 +00:00
Andy Wilkinson
950eafe9cc Improve diagnostics when ServletContext.addListener fails
The various servlet containers that we support vary in the quality
of their diagnostics when ServletContext.addListener fails. To make
problem diagnosis easier, this commit ensures that the toString of the
the listener that was being added is included in the exception that's
thrown when a failure occurs.

Closes gh-2197
2014-12-18 15:31:22 +00:00
Phillip Webb
1ef77d7d97 Protect against null CodeSource location
Update LogbackLoggingSystem to protect against a potential null
CodeSource result.

Fixes gh-2149
2014-12-14 13:43:00 -08:00
Phillip Webb
c22018aaa1 Polish 2014-12-14 13:40:46 -08:00
Spring Buildmaster
63e6a25097 Next development version 2014-12-10 18:06:30 -08:00
Phillip Webb
10726ffea3 Make DEFAULT_PROTOCOL public
Fixes gh-2110
2014-12-10 15:23:40 -08:00
Phillip Webb
1c031abdd2 Fix session timeout default value
Update DEFAULT_SESSION_TIMEOUT to use TimeUnit.MINUTES.toSeconds(30)
rather than TimeUnit.SECONDS.toMinutes(30) which would always return
0.

See gh-2084
(cherry picked from commit b33bbd56)
2014-12-08 21:53:34 -08:00
Phillip Webb
c23a764a1c Set the default session timeout to 30 mins
Update AbstractConfigurableEmbeddedServletContainer to set the default
session timeout to 30 minutes. Also correct Javadoc to specify that
the default is '30 minutes'.

Fixes gh-2084
2014-12-08 11:12:40 -08:00
Phillip Webb
c9a3919af9 Add LoggingApplicationListener constants
Extract some of the common property keys as constants.

Fixes gh-2068
2014-12-05 10:23:55 -08:00
Phillip Webb
b519eda441 Make ErrorPageFilter public
Change the visibility of ErrorPageFilter to public to fix
IllegalAccessException errors on certain servlet containers.

Fixes gh-2026
2014-12-01 14:13:44 -08:00
Phillip Webb
ffe5348083 Polish formatting 2014-12-01 13:46:06 -08:00
Dave Syer
23e7028abb Ensure java.io.tmpdir is available before using it
Some environments do not have a tmpdir so it can be null.
2014-11-20 12:01:24 +00:00
Andy Wilkinson
59ebc3b320 When Logback is the logging system, ensure that JBoss logging uses it
Previously, if Logback was being used as Boot's logging system, but
Log4J was also on the classpath before SLF4J and Logback, JBoss
Logging would use Log4J for its logging. This lead to warning messages
being produced as Log4J was not configured:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.

This commit updates LogbackLoggingSystem to set the
org.jboss.logging.provider to "slf4j". This ensure that JBoss Logging
will use SLF4J and Logback as intended even when Log4J is also on the
classpath.

Closes gh-1928
2014-11-20 10:41:43 +00:00
Andy Wilkinson
863c099161 Add missing copyright headers 2014-11-18 21:29:54 +00:00
Phillip Webb
0408eb413f Add profile to ConfigFileApplicationListener log
Fixes gh-1948
2014-11-18 12:04:46 -08:00
Andy Wilkinson
6ab47db19d Omit null pathInfo from ErrorPageFilter's error message
Fixes gh-1944
2014-11-18 10:41:27 +00:00
Andy Wilkinson
41cb567894 Don't flush in ErrorPageFilter for < 400 response that's committed
Previously, for a non-async response with a successful status (< 400),
ErrorPageFilter would always call flushBuffer. This triggers an
exception in Tomcat if the client has closed the connection before the
response has been fully sent. In this case, Tomcat treats the response
as successful and commits it before control returns to the filter.

This commit updates ErrorPageFilter to only perform the flush if the
response has not already been committed, leaving any further flushing
that may be necessary to be handled by the servlet container.

Fixes gh-1938
2014-11-18 10:23:55 +00:00
Spring Buildmaster
46b7738334 Next development version 2014-11-11 17:12:24 -08:00
Phillip Webb
a832944c05 Rename HtppClientOption to HttpClientOption
Fixes gh-1874
2014-11-11 09:33:29 -08:00
Phillip Webb
57a4cb1aee Fix debug logging
Fix an issue where debug logging never occurred because it was guarded
incorrectly using isWarnEnabled().

Fixes gh-1780
2014-11-05 08:17:11 -08:00
Andy Wilkinson
9a2d654eba Rename test classes so that their tests are run by Maven 2014-10-15 16:35:48 +01:00
Spring Buildmaster
3e71a21b30 Next development version 2014-10-10 15:19:47 -07:00
Phillip Webb
6009f41782 Polish 2014-10-09 12:58:55 -07:00
Dave Syer
3b2fb305c8 Add placeholder support to LoggingApplicationListener
When logging.level.* is set in external configuration they can now
contain placeholders.

Fixes gh-1680
2014-10-09 19:13:41 +01:00
John Tims
77bf3ad90e Fix typo in javadoc
(Cherry picked from commit bebbe92)
Fixes gh-1633
2014-10-06 18:05:10 -07:00
Dave Syer
c3d1241e71 Allow override of pidfile location
The file name can now be overridden at runtime with a System property or
environment variable named "PIDFILE" (or "pidfile").

Fixes gh-1579
2014-10-01 16:11:11 +01:00
Dave Syer
0ff511d978 Catch Throwable instead of Exception in Spring Application
...so that application startup that fails because of an Error (for
instance NoClassDefFoundError) won't be swallowed.

Fixes gh-1645
2014-10-01 15:50:49 +01:00
Andy Wilkinson
e47435f1b1 Include code source location in message for competing LoggerFactory impl
To make it easier to identify the source of the competing LoggerFactory
implementation, this commit updates the exception message to include
the code source location of the offending class.

Closes gh-1630
2014-10-01 13:49:55 +01:00
Spring Buildmaster
edb4b7ed7d Next development version 2014-09-25 21:02:37 -07:00
Andy Wilkinson
72ef1d6554 Update ErrorPageFilter so it won’t try to forward a committed response
In some scenarios, the ErrorPageFilter will want to forward the request
to an error page but the response has already been committed. One common
cause of this is when the filter’s running on WAS. WAS calls
flushBuffer() (which commits the response), upon a clean exit from a
servlet’s service method.

Previously, the filter would attempt the forward, even if the response
was committed. This would result in an IllegalStateException and a
possibly incomplete response that may also have an incorrect status
code.

This commit updates the ErrorPageFilter to check to see if the response
has already been committed before it attempts to forward the request to
the error page. If the response has already been committed, the filter
logs an error and allows the container’s normal handling to kick in.
This prevents an IllegalStateException from being thrown.

This commit also updates the response wrapper to keep track of when
sendError has been called. Now, when flushBuffer is called, if
sendError has been called, the wrapper calls sendError on the wrapped
response. This prevents the wrapper from suppressing an error when the
response is committed before the request handling returns to the error
page filter.

Closes gh-1575
2014-09-25 19:05:59 +01:00
Phillip Webb
0b50fe4eff Support String to char[] bindings
Update RelaxedConversionService to also support String to char[]
conversion. Primarily to support the `password` field in
MongoProperties.

Fixes gh-1572
2014-09-24 16:03:51 -07:00
Phillip Webb
23ff7c91d6 Add debug logging to ConfigFileApplicationListener
Update ConfigFileApplicationListener to include more debug level output.
Debug messages are recorded during onApplicationEnvironmentPreparedEvent
but not actually output until onApplicationPreparedEvent. This is
because the logging level might not have been correctly set until the
context is completely prepared.

Fixes gh-1584
2014-09-24 14:08:14 -07:00
Andy Wilkinson
c420249f7d Detect startup failures in additional Tomcat connectors
Previously, only the state of the primary connector was checked when
verifying that the embedded Tomcat instance has started successfully.
This commit updates the verification logic to examine all of the
service's connectors, thereby also detecting startup failures of any
additional connectors the have been configured.

A check on the primary connector's state has been removed from
initialize as, at this stage, its state will always be NEW.

Fixes gh-1591
2014-09-23 11:56:40 +01:00
Phillip Webb
468db03aef Formatting 2014-09-19 22:41:10 -07:00
Dave Syer
d6165d97dd A few tweaks that might improve performance on startup
... or couldn't hurt anyway.

1. Extends the definition of a web application for @ConditionalOnWebapp
so that a StandardEnvironment can be used (cutting out JNDI failures
for Environment properties)

2. Doesn't bother using StandardServletEnvironment in integration tests

3. Make the NON_ENUMERABLE_ENUMERABLES in PropertySourcesPropertyValues
static so they only get initialized once (not a huge issue at all)
2014-09-19 16:11:10 +01:00
Andy Wilkinson
6248fc0d60 Fix logic for identifying test classes on Windows
Use File.separator rather than hard-coding the use of ‘/‘

Closes gh-1571
2014-09-18 16:45:07 +01:00
Phillip Webb
bebcd60b7c Call LoggerContext.reset() during logback init
Update `LogbackLoggingSystem` to call the `reset()` method on the
`LoggerContext` before initialization.

This will hopefully reset the context to prevent the same appenders
from being accidentally added more than once.

Fixes gh-1091
2014-09-17 18:05:08 -07:00
Andy Wilkinson
6dcaec2fef Make all @Bean methods public
This is a continuation of the changes made in 611f978. It makes some
more @Bean methods public and adds tests to spring-boot-actuator and
spring-boot-autoconfigure to prevent against non-public methods being
introduced in the future

Closes gh-1571
2014-09-17 19:39:39 +01:00
Phillip Webb
9e9e450211 Fix @Since tag 2014-09-17 10:12:48 -07:00
Phillip Webb
62a5ce52d0 Backport Jetty/Tomcat SSL support
Fixes gh-1570
Cherry-picked from 0960908 and 258c6f1
2014-09-17 10:08:05 -07:00
Spring Buildmaster
d63e4b4329 Next development version 2014-09-04 12:15:18 -07:00
Phillip Webb
eaa3bd040d Apply eclipse formatting rules 2014-09-04 09:39:58 -07:00
Phillip Webb
7e6bad8d4b Fix @ActiveProfile to override existing profiles
Change SpringApplicationContextLoader to set active profiles using the
`spring.profiles.active` environment property rather than calling
`SpringApplication.setAdditionalProfiles`. This allows @ActiveProfiles
to replace existing profiles rather than add to them which is consistent
with the Spring TestContext Framework.

Fixes gh-1469
2014-09-03 15:01:52 -07:00
Phillip Webb
c2ff7ca80f Add HtppClientOptions to TestRestTemplate
Allow customization of the Apache HTTP Client used in TestRestTemplate
via an options enum.

Fixes gh-1497
2014-09-03 14:15:47 -07:00
Phillip Webb
bedb44adc8 Ensure non-remapped calls are still logged
Update LevelRemappingAppender to that any calls that aren't remapped
are still logged.

Fixes gh-1481
2014-09-03 11:45:09 -07:00
Phillip Webb
0c0a0a7738 Convert session timeout to minutes for Tomcat
Convert any session timeout values from seconds to minutes when
configuring Tomcat.

Fixes gh-1422
2014-08-28 14:24:55 -07:00
Phillip Webb
a07f0272f9 Polish 2014-08-28 11:15:14 -07:00
Phillip Webb
a5484e47cd Extract getServletContextInitializerBeans logic
Extract the hairy logic from getServletContextInitializerBeans() to a
new class and refactor things a little.
2014-08-28 10:06:47 -07:00