Search code examples
javatomcat

Tomcat catalina.out is 40GB


I wonder why my spring project with tomcat server got catalina.out file with size 40GB. Any solutions, please.

catalina.out reach 40 GB


Solution

  • catalina.out reaches such a large size because:

    1- there might be many logging messages sent to console handler, and

    2- also there is not any rotation of catalina.out (and no policy to remove older catalina.out).

    First, as there might be some duplication and the messages in catalina.out , which could also be stored in *log messages too, I'd check if the contents of the log files (catalina.[DATE].log) are the same as those of catalina.out, if so then you can edit file conf/logging.properties and remove console handler

    I'd also check the level of the log messages and set a higher level if possible. Look for this line in conf/logging.properties

    java.util.logging.ConsoleHandler.level = ....
    

    Possible levels, in increasing level of frequency are SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST or ALL. I'd try replace ALL, FINEST, FINER, FINE by CONFIG or even INFO. For instance, by setting it to INFO, all SEVERE, WARNING and INFO messages will be logged but not any with a level to the right of that list.

    Also another option is set a limit to console handler by adding this line to conf/logging.properties

    java.util.logging.ConsoleHandler.limit = 1024000
    

    and rotate catalina.out configuring an automatic task to remove older ones.