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
pull/37210/head
Stephane Nicoll 1 year ago
parent 4d75f2cb08
commit 94c7140001

@ -284,7 +284,7 @@ task runRemoteSpringApplicationExample(type: org.springframework.boot.build.docs
task runSpringApplicationExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
classpath = configurations.springApplicationExample + sourceSets.main.output
mainClass = "org.springframework.boot.docs.features.springapplication.MyApplication"
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
args = ["--server.port=0"]
output = file("$buildDir/example-output/spring-application.txt")
expectedLogging = "Started MyApplication in "
@ -293,7 +293,7 @@ task runSpringApplicationExample(type: org.springframework.boot.build.docs.Appli
task runLoggingFormatExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
classpath = configurations.springApplicationExample + sourceSets.main.output
mainClass = "org.springframework.boot.docs.features.springapplication.MyApplication"
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
args = ["--spring.main.banner-mode=off", "--server.port=0"]
output = file("$buildDir/example-output/logging-format.txt")
expectedLogging = "Started MyApplication in "

@ -0,0 +1,34 @@
/*
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.docs.features.logexample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Sample application used to collect logs for the reference doc.
*
* @author Stephane Nicoll
*/
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
Loading…
Cancel
Save