簡體   English   中英

Apache Tomcat Windows stdout/stderr 配置

[英]Apache Tomcat Windows stdout/stderr configuration

像我之前的許多其他成員一樣,我對在 Windows 上配置 Apache Tomcat 日志記錄有一些疑問。 更具體地說,我的問題圍繞着限制為 Apache Tomcat 服務器的 stderr/stdout 創建的日志文件的大小和數量的正確方法作為一個整體。

我的 Java 知識幾乎僅限於我能夠在網上搜索中找到的任何內容。

我相信我理解的是:

  • Windows 上的 Apache Tomcat 服務默認為 -std(out|err).yyyy-mm-dd.log
  • Apache Tomcat 服務在 Java 啟動定義中使用以下選項:
      -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager\n   -Djava.util.logging.config.file=<tomcat_home>\\conf\\logging.properties
  • Apache Tomcat 服務在 logging.properties 文件中定義了其大部分核心日志記錄選項。

  • 是否有適當的配置/指令/選項可以/應該添加到 logging.properties 文件中以限制 std(out|err) 日志文件的大小、數量、計數等?

    我的主要困惑在於如何在 logging.properties 文件中定義與 Tomcat 服務本身相關的記錄器和處理程序。

    如果在發布此之前我沒有找到的另一個線程中已經回答了這個問題,請重定向我。 我試圖遵循 Apache 的日志記錄文檔( https://tomcat.apache.org/tomcat-9.0-doc/logging.html ),但我不知道是否可以簡單地添加選項,如maxDayscountmaxCapSize (或任何適當的選項和值應該是)直接放入 <tomcat_home>\\conf\\logging.properties 文件中,或者我是否必須使用不同的方式?

    任何讓我更好地理解這一點以及如何實現我的最終目標(限制 std(out|err) 日志文件的數量和大小的幫助或指導)都是並將不勝感激!

    謝謝!
    格雷格

    根據Apache Tomcat 9 Windows Service How-To只有以下選項:

    --LogPath   %SystemRoot%\System32\LogFiles\Apache   Defines the path for logging.  Creates the directory if necessary.
    --LogPrefix commons-daemon  Defines the service log filename prefix. The log file is created in the LogPath directory with .YEAR-MONTH-DAY.log suffix
    --LogLevel  Info    Defines the logging level and can be either Error, Info, Warn or Debug. (Case insensitive).
    --StdOutput     Redirected stdout filename. If named auto then file is created inside LogPath with the name service-stdout.YEAR-MONTH-DAY.log.
    --StdError      Redirected stderr filename. If named auto then file is created inside LogPath with the name service-stderr.YEAR-MONTH-DAY.log.
    

    看起來要刪除文件,您必須創建計划任務才能這樣做。

    暫無
    暫無

    聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

     
    粵ICP備18138465號  © 2020-2024 STACKOOM.COM