Skip to content

Commit 94c7140

Browse files
committed
Use a dedicated application to collect log samples
This commit moves the tasks that collect log samples for the reference guide to an isolated application. Closes gh-36875
1 parent 4d75f2c commit 94c7140

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

spring-boot-project/spring-boot-docs/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ task runRemoteSpringApplicationExample(type: org.springframework.boot.build.docs
284284

285285
task runSpringApplicationExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
286286
classpath = configurations.springApplicationExample + sourceSets.main.output
287-
mainClass = "org.springframework.boot.docs.features.springapplication.MyApplication"
287+
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
288288
args = ["--server.port=0"]
289289
output = file("$buildDir/example-output/spring-application.txt")
290290
expectedLogging = "Started MyApplication in "
@@ -293,7 +293,7 @@ task runSpringApplicationExample(type: org.springframework.boot.build.docs.Appli
293293

294294
task runLoggingFormatExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
295295
classpath = configurations.springApplicationExample + sourceSets.main.output
296-
mainClass = "org.springframework.boot.docs.features.springapplication.MyApplication"
296+
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
297297
args = ["--spring.main.banner-mode=off", "--server.port=0"]
298298
output = file("$buildDir/example-output/logging-format.txt")
299299
expectedLogging = "Started MyApplication in "
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2012-2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.docs.features.logexample;
18+
19+
import org.springframework.boot.SpringApplication;
20+
import org.springframework.boot.autoconfigure.SpringBootApplication;
21+
22+
/**
23+
* Sample application used to collect logs for the reference doc.
24+
*
25+
* @author Stephane Nicoll
26+
*/
27+
@SpringBootApplication
28+
public class MyApplication {
29+
30+
public static void main(String[] args) {
31+
SpringApplication.run(MyApplication.class, args);
32+
}
33+
34+
}

0 commit comments

Comments
 (0)