Sep 22

If you’re Java process (eg. Tomcat) is running out of PermGen space then you can increase the available space with the following JVM command line option

-XX:MaxPermSize=512m

That would for example increase the amount of PermGen space to 512 MB.

written by objects \\ tags: , , , ,

Jul 23

Log4j comes with an appender that will send an email when a logging event occurs. The appender class is org.apache.log4j.net.SMTPAppender and the following gives an example of its configuration

<appender name="LogEmail" class="org.apache.log4j.net.SMTPAppender">
  <param name="BufferSize" value="512" />
  <param name="SMTPHost" value="mail.server.com" />
  <param name="From" value="myapp@server.com" />
  <param name="To" value="support@server.com" />
  <param name="Subject" value="Log from myapp" />
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
      value="%p %t %c - %m%n" />
  </layout>
</appender>

written by objects \\ tags: , ,

Jul 18

The default logging configuration that ships with Tomcat 6.0 logs to both catalina.out and also a daily log catalina.yyyy-mm-dd.log. The daily log starts a new file everyday, but catalina.out just continues to grow until your disk fills up.

To make things worse if you want to purge catalina.out you need to restart tomcat to free up the disk space used as tomcat holds the file open.

To avoid this situation what you can do is remove the logging to catalina.out (by removing the handler). This can be achieved by editting conf/logging.properties and changing:

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

to

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

written by objects \\ tags: , ,