[英]Is logging in Tomcat webserver async by default?
Usually my logging is as follows:通常我的日志如下:
private final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(this.getClass());
Question: if I deploy my app as a war
to a tomcat
webserver, is the logging sync or async by default?问题:如果我将我的应用程序作为
war
部署到tomcat
网络服务器,默认情况下日志记录是同步还是异步?
I'm asking because the tomcats logging.properties
file defines the AsyncFileHandler
throughout, like .handlers = 1catalina.org.apache.juli.AsyncFileHandler
.我问是因为 tomcats
logging.properties
文件定义了AsyncFileHandler
,比如.handlers = 1catalina.org.apache.juli.AsyncFileHandler
。
My question is, if all of my log statements are "passed" to that tomcat async file handler, and then logged async automatically?我的问题是,如果我的所有日志语句都“传递”给那个 tomcat 异步文件处理程序,然后自动记录异步?
Tomcat's logging is irrelevant if you are using a separate logging framework (such as SLF4J) in your web application.如果您在 Web 应用程序中使用单独的日志记录框架(例如 SLF4J),则 Tomcat 的日志记录无关紧要。 The SLF4J docs should tell you what is synchronous and what is asynchronous in that framework.
SLF4J 文档应该告诉您在该框架中什么是同步的,什么是异步的。
For the record, Tomcat's internal logging is synchronous until it gets to the AsyncFileHandler
where it is buffered and written asynchronously on a separate thread (because writing to the file system is usually the slowest part of the logging call).作为记录,Tomcat 的内部日志记录是同步的,直到它到达
AsyncFileHandler
,在那里它被缓冲并在单独的线程上异步写入(因为写入文件系统通常是日志记录调用中最慢的部分)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.