【发布时间】:2018-01-10 20:02:49
【问题描述】:
我有一个使用 Java 8 部署到 App Engine 标准环境的 Spring Boot 应用程序。我似乎无法在云控制台的日志查看器中显示日志消息。我确实有其他日志在工作,例如被命中的端点。
logging.properties:
.level = FINEST
appengine-web.xml:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<threadsafe>true</threadsafe>
<runtime>java8</runtime>
<service>logging-service</service>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
弹簧控制器:
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/log")
public class LogSubscription {
private static final Logger log = Logger.getLogger(LogSubscription.class.getName());
@RequestMapping(method = GET)
public String logSomething() {
log.log(Level.INFO, "Should see this in the console");
log.log(Level.SEVERE, "This is severe");
log.info("Normal Log Message");
return "Should log successfully";
}
}
当我在本地运行时,登录到控制台工作得非常好。我只是在 Web 控制台中看不到日志。我可以看到 GET 请求,但看不到其中的日志记录。我附上我的日志截图。
【问题讨论】:
标签: google-app-engine spring-boot logging