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
f7739a67
Commit
f7739a67
authored
Nov 16, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7390 from nebhale/logger-actuator-docs
* pr/7390: Add Logger actuator documentation
parents
1d2f6d25
00099552
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
0 deletions
+116
-0
loggers.adoc
spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc
+61
-0
EndpointDocumentation.java
...mework/boot/actuate/hypermedia/EndpointDocumentation.java
+18
-0
production-ready-features.adoc
...oot-docs/src/main/asciidoc/production-ready-features.adoc
+37
-0
No files found.
spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc
0 → 100644
View file @
f7739a67
=== /loggers
This endpoint allows you to view and modify the log levels for the loggers in your
application. It builds on top of the `LoggingSystem` abstraction and supports the same
logging frameworks. The logging levels are defined by the `LogLevel` enumeration and
consists of the following values (although not all logging systems support the full set):
* `TRACE`
* `DEBUG`
* `INFO`
* `WARN`
* `ERROR`
* `FATAL`
* `OFF`
* `null`
The `configuredLevel` property reflects an explicitly configured logger level, while the
`effectiveLevel` property reflects the logger level inherited from parent loggers. The
`effectiveLevel` is managed by each logging framework and reflects the propagation rules
inherent to and configured in that framework. `null` indicates that there is no explicit
configuration defined.
==== Listing All Loggers
Example curl request:
include::{generated}/loggers/curl-request.adoc[]
Example HTTP request: [small]##link:../health[icon:external-link[role="silver"]]##
include::{generated}/loggers/http-request.adoc[]
Example HTTP response:
include::{generated}/loggers/http-response.adoc[]
==== Getting a Single Logger
Example curl request:
include::{generated}/single-logger/curl-request.adoc[]
Example HTTP request: [small]##link:../health[icon:external-link[role="silver"]]##
include::{generated}/single-logger/http-request.adoc[]
Example HTTP response:
include::{generated}/single-logger/http-response.adoc[]
==== Configuring a Logger
Setting the `configuredLevel` of a logger requires `POSTing` a partial payload to the
resource. The `configuredLevel` property must contain a string representation of the
enumeration described above. `null` indicates that the log level should be unset,
allowing it to inherit configuration from it's parent.
Example curl request:
include::{generated}/set-logger/curl-request.adoc[]
Example HTTP request: [small]##link:../health[icon:external-link[role="silver"]]##
include::{generated}/set-logger/http-request.adoc[]
Example HTTP response:
include::{generated}/set-logger/http-response.adoc[]
spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java
View file @
f7739a67
...
@@ -58,6 +58,7 @@ import org.springframework.util.StringUtils;
...
@@ -58,6 +58,7 @@ import org.springframework.util.StringUtils;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
MockMvcRestDocumentation
.
document
;
import
static
org
.
springframework
.
restdocs
.
mockmvc
.
MockMvcRestDocumentation
.
document
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
...
@@ -108,6 +109,23 @@ public class EndpointDocumentation {
...
@@ -108,6 +109,23 @@ public class EndpointDocumentation {
.
andDo
(
document
(
"partial-logfile"
));
.
andDo
(
document
(
"partial-logfile"
));
}
}
@Test
public
void
singleLogger
()
throws
Exception
{
this
.
mockMvc
.
perform
(
get
(
"/loggers/org.springframework.boot"
)
.
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
()).
andDo
(
document
(
"single-logger"
));
}
@Test
public
void
setLogger
()
throws
Exception
{
this
.
mockMvc
.
perform
(
post
(
"/loggers/org.springframework.boot"
)
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
content
(
"{\"configuredLevel\": \"DEBUG\"}"
))
.
andExpect
(
status
().
isOk
()).
andDo
(
document
(
"set-logger"
));
}
@Test
@Test
public
void
endpoints
()
throws
Exception
{
public
void
endpoints
()
throws
Exception
{
final
File
docs
=
new
File
(
"src/main/asciidoc"
);
final
File
docs
=
new
File
(
"src/main/asciidoc"
);
...
...
spring-boot-docs/src/main/asciidoc/production-ready-features.adoc
View file @
f7739a67
...
@@ -108,6 +108,10 @@ authenticated).
...
@@ -108,6 +108,10 @@ authenticated).
|Displays arbitrary application info.
|Displays arbitrary application info.
|false
|false
|`loggers`
|Shows and modifies the configuration of loggers in the application.
|true
|`liquibase`
|`liquibase`
|Shows any Liquibase database migrations that have been applied.
|Shows any Liquibase database migrations that have been applied.
|true
|true
...
@@ -945,6 +949,39 @@ documentation].
...
@@ -945,6 +949,39 @@ documentation].
[[
production
-
ready
-
loggers
]]
==
Loggers
Spring
Boot
Actuator
includes
the
ability
to
view
and
configure
the
log
levels
of
your
application
at
runtime
.
You
can
view
either
the
entire
list
or
an
individual
logger
's
configuration which is made up of both the explictily configured logging level as well as
the effective logging level given to it by the logging framework. These levels can be:
* `TRACE`
* `DEBUG`
* `INFO`
* `WARN`
* `ERROR`
* `FATAL`
* `OFF`
* `null`
with `null` indicating that there is no explict configuration.
[[production-ready-logger-configuration]]
=== Configure a Logger
In order to configure a given logger, you `POST` a partial entity to the resource'
s
URI
:
[
source
,
json
,
indent
=
0
]
----
{
"configuredLevel"
:
"DEBUG"
}
----
[[
production
-
ready
-
metrics
]]
[[
production
-
ready
-
metrics
]]
==
Metrics
==
Metrics
Spring
Boot
Actuator
includes
a
metrics
service
with
'`gauge`'
and
'`counter`'
support
.
Spring
Boot
Actuator
includes
a
metrics
service
with
'`gauge`'
and
'`counter`'
support
.
...
...
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