The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting Easy-Tomcat Log

Discussion in 'EasyApache' started by yoachan, Jun 13, 2014.

  1. yoachan

    yoachan Well-Known Member

    Joined:
    Jan 10, 2010
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Dear all,

    We used to use tomcat5 and Solr on our server. But since latest CPanel, we start to use Tomcat7 that came as easy-tomcat7. Several months passed, and everything went OK till we realized that something wrong with Tomcat's logging. Each week it generates around 3GB of log, which if we look at our transaction, it absolutely make sense. But that's not what we need. Tomcat seems to log EVERYTHING.
    What we need is Tomcat only log warnings and errors. That's it.

    So I checked Tomcat's config to look how Tomcat sets it's log configuration. I found two files at
    /usr/local/easy/share/easy-tomcat7/conf which are

    logging.properties
    Code:
    # 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
    #
    #     [url]http://www.apache.org/licenses/LICENSE-2.0[/url]
    #
    # 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}/logs
    1catalina.org.apache.juli.FileHandler.prefix = catalina.
    
    2localhost.org.apache.juli.FileHandler.level = FINE
    2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
    2localhost.org.apache.juli.FileHandler.prefix = localhost.
    
    3manager.org.apache.juli.FileHandler.level = FINE
    3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/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}/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, set the org.apache.catalina.util.LifecycleBase logger to log
    # each component that extends LifecycleBase changing state:
    #org.apache.catalina.util.LifecycleBase.level = FINE
    
    # To see debug messages in TldLocationsCache, uncomment the following line:
    #org.apache.jasper.compiler.TldLocationsCache.level = FINE
    
    and log4j.properties
    Code:
    log4j.rootLogger=debug, R
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=${catalina.home}/logs/tomcat.log
    log4j.appender.R.MaxFileSize=10MB
    log4j.appender.R.MaxBackupIndex=10
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    log4j.logger.org.apache.catalina=DEBUG, R
    log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG, R
    log4j.logger.org.apache.catalina.core=DEBUG, R
    log4j.logger.org.apache.catalina.session=DEBUG, R
    
    So I start editing everything that says "INFO", "DEBUG", or "FINE" and set it to "WARNING". I restart easy-tomcat7 service

    Code:
    # /etc/init.d/easy-tomcat7 restart
    
    and....... nothing. Tomcat still do logging in light speed. Did I missed something?
    How should I change Tomcat's logging behavior to log only warnings and errors?

    Any help appreciated.

    Regards,

    Yoachan
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    The log4j.properties file indicates that maximum file size should be 10MB. Could you verify which particular log file has reached 3GB?

    Thank you.
     
  3. yoachan

    yoachan Well-Known Member

    Joined:
    Jan 10, 2010
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Dead Michael,
    Thank you for your reply, and sorry for my late reply.

    Here are log sizes as for now

    Code:
         532M catalina.err
         2.2M  catalina.out
         497M localhost_access.log
    
    Basically catalina.err and localhost_access.log can reach Gigs, usually 2-3 GB each week.

    Regards,

    YoChan
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Please open a support ticket so we can take a closer look. While Tomcat administration falls outside the scope of support, we should be able to determine if the default Tomcat logging configuration is working as intended. You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  5. yoachan

    yoachan Well-Known Member

    Joined:
    Jan 10, 2010
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Dear Michael,

    Thank you for your suggestion.
    I have posted a ticket, and the ticket id is 5113103.
    Regards,

    YoChan

    PS. seems that I can't edit my previous post, and sorry for my greeting 'Dead Michael' which is supposed to be 'Dear Michael'.... My apologies
     
    #5 yoachan, Jun 17, 2014
    Last edited: Jun 17, 2014
  6. yoachan

    yoachan Well-Known Member

    Joined:
    Jan 10, 2010
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    Ok, just in case someone stuck with this kind of problem, here's what support (finnaly) said or conclude:

    So, no luck from CPanel side....
    with doubt though.... but that's the best answer I can get for now...
     
Loading...

Share This Page