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
d590c3ed
Commit
d590c3ed
authored
Jul 10, 2019
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x'
Closes gh-17486
parents
dc043266
773dda3d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
39 deletions
+60
-39
LogFileWebEndpointAutoConfiguration.java
...onfigure/logging/LogFileWebEndpointAutoConfiguration.java
+4
-2
LogFileWebEndpointDocumentationTests.java
...b/documentation/LogFileWebEndpointDocumentationTests.java
+2
-1
LogFileWebEndpoint.java
...ingframework/boot/actuate/logging/LogFileWebEndpoint.java
+6
-12
LogFileWebEndpointTests.java
...amework/boot/actuate/logging/LogFileWebEndpointTests.java
+10
-7
LogFileWebEndpointWebIntegrationTests.java
...ctuate/logging/LogFileWebEndpointWebIntegrationTests.java
+15
-13
LoggingApplicationListener.java
...work/boot/context/logging/LoggingApplicationListener.java
+14
-4
EndpointsPropertiesSampleActuatorApplicationTests.java
...or/EndpointsPropertiesSampleActuatorApplicationTests.java
+7
-0
application-endpoints.properties
...uator/src/test/resources/application-endpoints.properties
+2
-0
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/LogFileWebEndpointAutoConfiguration.java
View file @
d590c3ed
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
.
logging
;
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
.
logging
;
import
org.springframework.beans.factory.ObjectProvider
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint
;
import
org.springframework.boot.actuate.logging.LogFileWebEndpoint
;
import
org.springframework.boot.actuate.logging.LogFileWebEndpoint
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
...
@@ -48,8 +49,9 @@ public class LogFileWebEndpointAutoConfiguration {
...
@@ -48,8 +49,9 @@ public class LogFileWebEndpointAutoConfiguration {
@Bean
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingBean
@Conditional
(
LogFileCondition
.
class
)
@Conditional
(
LogFileCondition
.
class
)
public
LogFileWebEndpoint
logFileWebEndpoint
(
Environment
environment
,
LogFileWebEndpointProperties
properties
)
{
public
LogFileWebEndpoint
logFileWebEndpoint
(
ObjectProvider
<
LogFile
>
logFile
,
return
new
LogFileWebEndpoint
(
environment
,
properties
.
getExternalFile
());
LogFileWebEndpointProperties
properties
)
{
return
new
LogFileWebEndpoint
(
logFile
.
getIfAvailable
(),
properties
.
getExternalFile
());
}
}
private
static
class
LogFileCondition
extends
SpringBootCondition
{
private
static
class
LogFileCondition
extends
SpringBootCondition
{
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LogFileWebEndpointDocumentationTests.java
View file @
d590c3ed
...
@@ -19,6 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentatio
...
@@ -19,6 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentatio
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.actuate.logging.LogFileWebEndpoint
;
import
org.springframework.boot.actuate.logging.LogFileWebEndpoint
;
import
org.springframework.boot.logging.LogFile
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
...
@@ -56,7 +57,7 @@ class LogFileWebEndpointDocumentationTests extends MockMvcEndpointDocumentationT
...
@@ -56,7 +57,7 @@ class LogFileWebEndpointDocumentationTests extends MockMvcEndpointDocumentationT
@Bean
@Bean
LogFileWebEndpoint
endpoint
(
Environment
environment
)
{
LogFileWebEndpoint
endpoint
(
Environment
environment
)
{
return
new
LogFileWebEndpoint
(
environment
);
return
new
LogFileWebEndpoint
(
LogFile
.
get
(
environment
),
null
);
}
}
}
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LogFileWebEndpoint.java
View file @
d590c3ed
...
@@ -25,7 +25,6 @@ import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
...
@@ -25,7 +25,6 @@ import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import
org.springframework.boot.actuate.endpoint.annotation.ReadOperation
;
import
org.springframework.boot.actuate.endpoint.annotation.ReadOperation
;
import
org.springframework.boot.actuate.endpoint.web.annotation.WebEndpoint
;
import
org.springframework.boot.actuate.endpoint.web.annotation.WebEndpoint
;
import
org.springframework.boot.logging.LogFile
;
import
org.springframework.boot.logging.LogFile
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
...
@@ -42,17 +41,13 @@ public class LogFileWebEndpoint {
...
@@ -42,17 +41,13 @@ public class LogFileWebEndpoint {
private
static
final
Log
logger
=
LogFactory
.
getLog
(
LogFileWebEndpoint
.
class
);
private
static
final
Log
logger
=
LogFactory
.
getLog
(
LogFileWebEndpoint
.
class
);
private
final
Environment
environment
;
private
File
externalFile
;
private
File
externalFile
;
public
LogFileWebEndpoint
(
Environment
environment
,
File
externalFile
)
{
private
final
LogFile
logFile
;
this
.
environment
=
environment
;
this
.
externalFile
=
externalFile
;
}
public
LogFileWebEndpoint
(
Environment
environment
)
{
public
LogFileWebEndpoint
(
LogFile
logFile
,
File
externalFile
)
{
this
(
environment
,
null
);
this
.
externalFile
=
externalFile
;
this
.
logFile
=
logFile
;
}
}
@ReadOperation
(
produces
=
"text/plain; charset=UTF-8"
)
@ReadOperation
(
produces
=
"text/plain; charset=UTF-8"
)
...
@@ -68,12 +63,11 @@ public class LogFileWebEndpoint {
...
@@ -68,12 +63,11 @@ public class LogFileWebEndpoint {
if
(
this
.
externalFile
!=
null
)
{
if
(
this
.
externalFile
!=
null
)
{
return
new
FileSystemResource
(
this
.
externalFile
);
return
new
FileSystemResource
(
this
.
externalFile
);
}
}
LogFile
logFile
=
LogFile
.
get
(
this
.
environment
);
if
(
this
.
logFile
==
null
)
{
if
(
logFile
==
null
)
{
logger
.
debug
(
"Missing 'logging.file.name' or 'logging.file.path' properties"
);
logger
.
debug
(
"Missing 'logging.file.name' or 'logging.file.path' properties"
);
return
null
;
return
null
;
}
}
return
new
FileSystemResource
(
logFile
.
toString
());
return
new
FileSystemResource
(
this
.
logFile
.
toString
());
}
}
}
}
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointTests.java
View file @
d590c3ed
...
@@ -25,6 +25,7 @@ import org.junit.jupiter.api.BeforeEach;
...
@@ -25,6 +25,7 @@ import org.junit.jupiter.api.BeforeEach;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.io.TempDir
;
import
org.junit.jupiter.api.io.TempDir
;
import
org.springframework.boot.logging.LogFile
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.mock.env.MockEnvironment
;
import
org.springframework.mock.env.MockEnvironment
;
import
org.springframework.util.FileCopyUtils
;
import
org.springframework.util.FileCopyUtils
;
...
@@ -43,8 +44,6 @@ class LogFileWebEndpointTests {
...
@@ -43,8 +44,6 @@ class LogFileWebEndpointTests {
private
final
MockEnvironment
environment
=
new
MockEnvironment
();
private
final
MockEnvironment
environment
=
new
MockEnvironment
();
private
final
LogFileWebEndpoint
endpoint
=
new
LogFileWebEndpoint
(
this
.
environment
);
private
File
logFile
;
private
File
logFile
;
@BeforeEach
@BeforeEach
...
@@ -55,19 +54,22 @@ class LogFileWebEndpointTests {
...
@@ -55,19 +54,22 @@ class LogFileWebEndpointTests {
@Test
@Test
void
nullResponseWithoutLogFile
()
{
void
nullResponseWithoutLogFile
()
{
assertThat
(
this
.
endpoint
.
logFile
()).
isNull
();
LogFileWebEndpoint
endpoint
=
new
LogFileWebEndpoint
(
null
,
null
);
assertThat
(
endpoint
.
logFile
()).
isNull
();
}
}
@Test
@Test
void
nullResponseWithMissingLogFile
()
{
void
nullResponseWithMissingLogFile
()
{
this
.
environment
.
setProperty
(
"logging.file.name"
,
"no_test.log"
);
this
.
environment
.
setProperty
(
"logging.file.name"
,
"no_test.log"
);
assertThat
(
this
.
endpoint
.
logFile
()).
isNull
();
LogFileWebEndpoint
endpoint
=
new
LogFileWebEndpoint
(
LogFile
.
get
(
this
.
environment
),
null
);
assertThat
(
endpoint
.
logFile
()).
isNull
();
}
}
@Test
@Test
void
resourceResponseWithLogFile
()
throws
Exception
{
void
resourceResponseWithLogFile
()
throws
Exception
{
this
.
environment
.
setProperty
(
"logging.file.name"
,
this
.
logFile
.
getAbsolutePath
());
this
.
environment
.
setProperty
(
"logging.file.name"
,
this
.
logFile
.
getAbsolutePath
());
Resource
resource
=
this
.
endpoint
.
logFile
();
LogFileWebEndpoint
endpoint
=
new
LogFileWebEndpoint
(
LogFile
.
get
(
this
.
environment
),
null
);
Resource
resource
=
endpoint
.
logFile
();
assertThat
(
resource
).
isNotNull
();
assertThat
(
resource
).
isNotNull
();
assertThat
(
contentOf
(
resource
.
getFile
())).
isEqualTo
(
"--TEST--"
);
assertThat
(
contentOf
(
resource
.
getFile
())).
isEqualTo
(
"--TEST--"
);
}
}
...
@@ -76,14 +78,15 @@ class LogFileWebEndpointTests {
...
@@ -76,14 +78,15 @@ class LogFileWebEndpointTests {
@Deprecated
@Deprecated
void
resourceResponseWithLogFileAndDeprecatedProperty
()
throws
Exception
{
void
resourceResponseWithLogFileAndDeprecatedProperty
()
throws
Exception
{
this
.
environment
.
setProperty
(
"logging.file"
,
this
.
logFile
.
getAbsolutePath
());
this
.
environment
.
setProperty
(
"logging.file"
,
this
.
logFile
.
getAbsolutePath
());
Resource
resource
=
this
.
endpoint
.
logFile
();
LogFileWebEndpoint
endpoint
=
new
LogFileWebEndpoint
(
LogFile
.
get
(
this
.
environment
),
null
);
Resource
resource
=
endpoint
.
logFile
();
assertThat
(
resource
).
isNotNull
();
assertThat
(
resource
).
isNotNull
();
assertThat
(
contentOf
(
resource
.
getFile
())).
isEqualTo
(
"--TEST--"
);
assertThat
(
contentOf
(
resource
.
getFile
())).
isEqualTo
(
"--TEST--"
);
}
}
@Test
@Test
void
resourceResponseWithExternalLogFile
()
throws
Exception
{
void
resourceResponseWithExternalLogFile
()
throws
Exception
{
LogFileWebEndpoint
endpoint
=
new
LogFileWebEndpoint
(
this
.
environment
,
this
.
logFile
);
LogFileWebEndpoint
endpoint
=
new
LogFileWebEndpoint
(
null
,
this
.
logFile
);
Resource
resource
=
endpoint
.
logFile
();
Resource
resource
=
endpoint
.
logFile
();
assertThat
(
resource
).
isNotNull
();
assertThat
(
resource
).
isNotNull
();
assertThat
(
contentOf
(
resource
.
getFile
())).
isEqualTo
(
"--TEST--"
);
assertThat
(
contentOf
(
resource
.
getFile
())).
isEqualTo
(
"--TEST--"
);
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LogFileWebEndpointWebIntegrationTests.java
View file @
d590c3ed
...
@@ -19,16 +19,17 @@ package org.springframework.boot.actuate.logging;
...
@@ -19,16 +19,17 @@ package org.springframework.boot.actuate.logging;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
org.junit.jupiter.api.BeforeAll
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.io.TempDir
;
import
org.junit.jupiter.api.io.TempDir
;
import
org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest
;
import
org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest
;
import
org.springframework.boot.
test.util.TestPropertyValues
;
import
org.springframework.boot.
logging.LogFile
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.env.Environment
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.mock.env.MockEnvironment
;
import
org.springframework.test.web.reactive.server.WebTestClient
;
import
org.springframework.test.web.reactive.server.WebTestClient
;
import
org.springframework.util.FileCopyUtils
;
import
org.springframework.util.FileCopyUtils
;
...
@@ -44,31 +45,28 @@ class LogFileWebEndpointWebIntegrationTests {
...
@@ -44,31 +45,28 @@ class LogFileWebEndpointWebIntegrationTests {
private
WebTestClient
client
;
private
WebTestClient
client
;
private
File
log
File
;
private
static
File
temp
File
;
@BeforeEach
@BeforeEach
void
setUp
(
@TempDir
File
temp
,
WebTestClient
client
,
ConfigurableApplicationContext
context
)
throws
IOException
{
void
setUp
(
WebTestClient
client
,
ConfigurableApplicationContext
context
)
{
this
.
logFile
=
new
File
(
temp
,
"test.log"
);
this
.
client
=
client
;
this
.
client
=
client
;
this
.
context
=
context
;
this
.
context
=
context
;
FileCopyUtils
.
copy
(
"--TEST--"
.
getBytes
(),
this
.
logFile
);
}
}
@
WebEndpointTest
@
BeforeAll
void
getRequestProduces404ResponseWhenLogFileNotFound
()
{
static
void
setup
(
@TempDir
File
temp
)
throws
IOException
{
t
his
.
client
.
get
().
uri
(
"/actuator/logfile"
).
exchange
().
expectStatus
().
isNotFound
()
;
t
empFile
=
temp
;
}
}
@WebEndpointTest
@WebEndpointTest
void
getRequestProducesResponseWithLogFile
()
{
void
getRequestProducesResponseWithLogFile
()
{
TestPropertyValues
.
of
(
"logging.file.name:"
+
this
.
logFile
.
getAbsolutePath
()).
applyTo
(
this
.
context
);
this
.
client
.
get
().
uri
(
"/actuator/logfile"
).
exchange
().
expectStatus
().
isOk
().
expectHeader
()
this
.
client
.
get
().
uri
(
"/actuator/logfile"
).
exchange
().
expectStatus
().
isOk
().
expectHeader
()
.
contentType
(
"text/plain; charset=UTF-8"
).
expectBody
(
String
.
class
).
isEqualTo
(
"--TEST--"
);
.
contentType
(
"text/plain; charset=UTF-8"
).
expectBody
(
String
.
class
).
isEqualTo
(
"--TEST--"
);
}
}
@WebEndpointTest
@WebEndpointTest
void
getRequestThatAcceptsTextPlainProducesResponseWithLogFile
()
{
void
getRequestThatAcceptsTextPlainProducesResponseWithLogFile
()
{
TestPropertyValues
.
of
(
"logging.file:"
+
this
.
logFile
.
getAbsolutePath
()).
applyTo
(
this
.
context
);
this
.
client
.
get
().
uri
(
"/actuator/logfile"
).
accept
(
MediaType
.
TEXT_PLAIN
).
exchange
().
expectStatus
().
isOk
()
this
.
client
.
get
().
uri
(
"/actuator/logfile"
).
accept
(
MediaType
.
TEXT_PLAIN
).
exchange
().
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
"text/plain; charset=UTF-8"
).
expectBody
(
String
.
class
).
isEqualTo
(
"--TEST--"
);
.
expectHeader
().
contentType
(
"text/plain; charset=UTF-8"
).
expectBody
(
String
.
class
).
isEqualTo
(
"--TEST--"
);
}
}
...
@@ -77,8 +75,12 @@ class LogFileWebEndpointWebIntegrationTests {
...
@@ -77,8 +75,12 @@ class LogFileWebEndpointWebIntegrationTests {
static
class
TestConfiguration
{
static
class
TestConfiguration
{
@Bean
@Bean
LogFileWebEndpoint
logFileEndpoint
(
Environment
environment
)
{
LogFileWebEndpoint
logFileEndpoint
()
throws
IOException
{
return
new
LogFileWebEndpoint
(
environment
);
File
logFile
=
new
File
(
tempFile
,
"test.log"
);
FileCopyUtils
.
copy
(
"--TEST--"
.
getBytes
(),
logFile
);
MockEnvironment
environment
=
new
MockEnvironment
();
environment
.
setProperty
(
"logging.file"
,
logFile
.
getAbsolutePath
());
return
new
LogFileWebEndpoint
(
LogFile
.
get
(
environment
),
null
);
}
}
}
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
View file @
d590c3ed
...
@@ -121,6 +121,11 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -121,6 +121,11 @@ public class LoggingApplicationListener implements GenericApplicationListener {
*/
*/
public
static
final
String
LOGGING_SYSTEM_BEAN_NAME
=
"springBootLoggingSystem"
;
public
static
final
String
LOGGING_SYSTEM_BEAN_NAME
=
"springBootLoggingSystem"
;
/**
* The name of the {@link LogFile} bean.
*/
public
static
final
String
LOGFILE_BEAN_NAME
=
"springBootLogFile"
;
private
static
final
Map
<
String
,
List
<
String
>>
DEFAULT_GROUP_LOGGERS
;
private
static
final
Map
<
String
,
List
<
String
>>
DEFAULT_GROUP_LOGGERS
;
static
{
static
{
MultiValueMap
<
String
,
String
>
loggers
=
new
LinkedMultiValueMap
<>();
MultiValueMap
<
String
,
String
>
loggers
=
new
LinkedMultiValueMap
<>();
...
@@ -161,6 +166,8 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -161,6 +166,8 @@ public class LoggingApplicationListener implements GenericApplicationListener {
private
LoggingSystem
loggingSystem
;
private
LoggingSystem
loggingSystem
;
private
LogFile
logFile
;
private
int
order
=
DEFAULT_ORDER
;
private
int
order
=
DEFAULT_ORDER
;
private
boolean
parseArgs
=
true
;
private
boolean
parseArgs
=
true
;
...
@@ -225,6 +232,9 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -225,6 +232,9 @@ public class LoggingApplicationListener implements GenericApplicationListener {
if
(!
beanFactory
.
containsBean
(
LOGGING_SYSTEM_BEAN_NAME
))
{
if
(!
beanFactory
.
containsBean
(
LOGGING_SYSTEM_BEAN_NAME
))
{
beanFactory
.
registerSingleton
(
LOGGING_SYSTEM_BEAN_NAME
,
this
.
loggingSystem
);
beanFactory
.
registerSingleton
(
LOGGING_SYSTEM_BEAN_NAME
,
this
.
loggingSystem
);
}
}
if
(
this
.
logFile
!=
null
&&
!
beanFactory
.
containsBean
(
LOGFILE_BEAN_NAME
))
{
beanFactory
.
registerSingleton
(
LOGFILE_BEAN_NAME
,
this
.
logFile
);
}
}
}
private
void
onContextClosedEvent
()
{
private
void
onContextClosedEvent
()
{
...
@@ -247,12 +257,12 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -247,12 +257,12 @@ public class LoggingApplicationListener implements GenericApplicationListener {
*/
*/
protected
void
initialize
(
ConfigurableEnvironment
environment
,
ClassLoader
classLoader
)
{
protected
void
initialize
(
ConfigurableEnvironment
environment
,
ClassLoader
classLoader
)
{
new
LoggingSystemProperties
(
environment
).
apply
();
new
LoggingSystemProperties
(
environment
).
apply
();
LogFile
logFile
=
LogFile
.
get
(
environment
);
this
.
logFile
=
LogFile
.
get
(
environment
);
if
(
logFile
!=
null
)
{
if
(
this
.
logFile
!=
null
)
{
logFile
.
applyToSystemProperties
();
this
.
logFile
.
applyToSystemProperties
();
}
}
initializeEarlyLoggingLevel
(
environment
);
initializeEarlyLoggingLevel
(
environment
);
initializeSystem
(
environment
,
this
.
loggingSystem
,
logFile
);
initializeSystem
(
environment
,
this
.
loggingSystem
,
this
.
logFile
);
initializeFinalLoggingLevels
(
environment
,
this
.
loggingSystem
);
initializeFinalLoggingLevels
(
environment
,
this
.
loggingSystem
);
registerShutdownHookIfNecessary
(
environment
,
this
.
loggingSystem
);
registerShutdownHookIfNecessary
(
environment
,
this
.
loggingSystem
);
}
}
...
...
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java
View file @
d590c3ed
...
@@ -63,6 +63,13 @@ class EndpointsPropertiesSampleActuatorApplicationTests {
...
@@ -63,6 +63,13 @@ class EndpointsPropertiesSampleActuatorApplicationTests {
assertThat
(
entity
.
getBody
()).
contains
(
"\"hello\":\"world\""
);
assertThat
(
entity
.
getBody
()).
contains
(
"\"hello\":\"world\""
);
}
}
@Test
void
logfileWithRandomName
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
withBasicAuth
(
"user"
,
getPassword
())
.
getForEntity
(
"/admin/logfile"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
private
String
getPassword
()
{
private
String
getPassword
()
{
return
"password"
;
return
"password"
;
}
}
...
...
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator/src/test/resources/application-endpoints.properties
View file @
d590c3ed
server.error.path
:
/oops
server.error.path
:
/oops
management.endpoint.health.show-details
:
always
management.endpoint.health.show-details
:
always
management.endpoints.web.base-path
:
/admin
management.endpoints.web.base-path
:
/admin
logging.file
=
./target/${spring.application.instance_id}.log
spring.application.instance_id
=
${random.value}
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