日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

更改 Tomcat 日志路徑

系統(tǒng) 2163 0

在開發(fā)/測(cè)試環(huán)境,日志是非常重要的。而公司對(duì)于測(cè)試環(huán)境進(jìn)行了控制,只有配置人員能連接訪問,而開發(fā)人員是無法獲取該服務(wù)器的信息的。在出現(xiàn)錯(cuò)誤時(shí),沒有異常日志,開發(fā)是很難重現(xiàn)問題的。因此需要對(duì)中間件 tomcat 進(jìn)行配置,將日志放到某個(gè)目錄下,開發(fā)人員可以通過瀏覽器就能查看日志。ok,開工:

目的 : 能通過瀏覽器檢查tomcat日志

方法 :將 tomcat 的日志放置到 $CATALINA_HOME/webapps/ROOT/logs 下,用戶就可以通過 http://xxx.xxx.xxx.xxx/logs/catalina.out 訪問日志了。

1. 修改tomcat/conf下的logging.properties?

      
        # Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements.  See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You 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

#

#     http://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.



handlers 
      
      = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler,
      
         java.util.logging.ConsoleHandler



.handlers 
      
      = 1catalina.org.apache.juli.FileHandler,
      
         java.util.logging.ConsoleHandler



############################################################

# Handler specific properties.

# Describes specific configuration info for Handlers.

############################################################



1catalina.org.apache.juli.FileHandler.level 
      
      =
      
         FINE

1catalina.org.apache.juli.FileHandler.directory 
      
      =
      
        
          
             ${catalina.base}/webapps/ROOT/logs
          
        
        

1catalina.org.apache.juli.FileHandler.prefix 
      
      =
      
         catalina.



2localhost.org.apache.juli.FileHandler.level 
      
      =
      
         FINE

2localhost.org.apache.juli.FileHandler.directory 
      
      =
      
        
          
             ${catalina.base}/webapps/ROOT/logs
          
        
        

2localhost.org.apache.juli.FileHandler.prefix 
      
      =
      
         localhost.



3manager.org.apache.juli.FileHandler.level 
      
      =
      
         FINE

3manager.org.apache.juli.FileHandler.directory 
      
      =
      
        
          
             ${catalina.base}/webapps/ROOT/logs
          
        
        

3manager.org.apache.juli.FileHandler.prefix 
      
      =
      
         manager.



4host-manager.org.apache.juli.FileHandler.level 
      
      =
      
         FINE

4host-manager.org.apache.juli.FileHandler.directory 
      
      =
      
        
          
             ${catalina.base}/webapps/ROOT/logs
          
        
        

4host-manager.org.apache.juli.FileHandler.prefix 
      
      =
      
         host-manager.



java.util.logging.ConsoleHandler.level 
      
      =
      
         FINE

java.util.logging.ConsoleHandler.formatter 
      
      =
      
         java.util.logging.SimpleFormatter





############################################################

# Facility specific properties.

# Provides extra control for each logger.

############################################################



org.apache.catalina.core.ContainerBase.
      
      
        [
      
      
        Catalina
      
      
        ]
      
      .
      
        [
      
      
        localhost
      
      
        ]
      
      .level =
      
         INFO

org.apache.catalina.core.ContainerBase.
      
      
        [
      
      
        Catalina
      
      
        ]
      
      .
      
        [
      
      
        localhost
      
      
        ]
      
      .handlers =
      
         2localhost.org.apache.juli.FileHandler



org.apache.catalina.core.ContainerBase.
      
      
        [
      
      
        Catalina
      
      
        ]
      
      .
      
        [
      
      
        localhost
      
      
        ]
      
      .
      
        [
      
      
        /manager
      
      
        ]
      
      .level =
      
         INFO

org.apache.catalina.core.ContainerBase.
      
      
        [
      
      
        Catalina
      
      
        ]
      
      .
      
        [
      
      
        localhost
      
      
        ]
      
      .
      
        [
      
      
        /manager
      
      
        ]
      
      .handlers =
      
         3manager.org.apache.juli.FileHandler



org.apache.catalina.core.ContainerBase.
      
      
        [
      
      
        Catalina
      
      
        ]
      
      .
      
        [
      
      
        localhost
      
      
        ]
      
      .
      
        [
      
      
        /host-manager
      
      
        ]
      
      .level =
      
         INFO

org.apache.catalina.core.ContainerBase.
      
      
        [
      
      
        Catalina
      
      
        ]
      
      .
      
        [
      
      
        localhost
      
      
        ]
      
      .
      
        [
      
      
        /host-manager
      
      
        ]
      
      .handlers =
      
         4host-manager.org.apache.juli.FileHandler



# For example
      
      ,
      
         to log debug messages in ContextConfig and HostConfig

# classes and to log only warnings and errors in other

# org.apache.catalina.** classes
      
      ,
      
         uncomment these lines:

#org.apache.catalina.startup.ContextConfig.level 
      
      =
      
         FINE

#org.apache.catalina.startup.HostConfig.level 
      
      =
      
         FINE

#org.apache.catalina.level 
      
      = WARNING
    

?

2. 修改tomcat/bin/catalina.sh?

?

      186 if [ -z "$CATALINA_OUT" ] ; then

187   CATALINA_OUT=
      
        
          "$CATALINA_BASE"/webapps/ROOT/logs/catalina.out
        
      
      

188 fi


    

【注意】紅色字體是需要修改的內(nèi)容,修改為當(dāng)前 tomcat 的最新的網(wǎng)站根目錄即可。

?

3、重啟 tomcat

4、使用瀏覽器即可查看日志:?http://xxx.xxx.xxx.xxxx/logs/catalina.out

?

更改 Tomcat 日志路徑


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會(huì)非常 感謝您的哦?。。?/p>

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 扎鲁特旗| 尉犁县| 广饶县| 义乌市| 澄城县| 舟曲县| 乌拉特前旗| 蚌埠市| 大同市| 新民市| 贵港市| 微山县| 曲周县| 宁乡县| 武安市| 开化县| 皋兰县| 聊城市| 万源市| 乌拉特中旗| 新疆| 长岭县| 阳山县| 保山市| 三都| 安吉县| 大庆市| 通州市| 新建县| 马鞍山市| 镇平县| 安福县| 孟州市| 西峡县| 如皋市| 平昌县| 桦川县| 会宁县| 灵川县| 桐庐县| 巫山县|