Thoughts on software development and other stuff

Archive for January, 2009

Coherence (and other) activities this week

with 2 comments

There are some Coherence related activities this week that the user community may be interested in.

First, the Winter 2009 NY Coherence SIG will be on Thursday January 29th at the Oracle office on Madison Ave in midtown. Registration is required in order for the bouncers in the lobby to let you in, so be sure to check the link and register if you plan on attending. Yours truly will be talking about using Coherence in production and a peek behind the scenes at the tools and techniques used to provide support for Coherence. We’ll also have one of our customers (Anthony Casalena, Founder and CEO of Squarespace, Inc.) presenting as well as one of our top architects Brian Oliver speaking about using Coherence in a WAN. He just gave a presentation at the London SIG last week that was well received.

For those in the Boston area, you can check out the Boston Scalability User Group in Waltham run by Anthony Chaves. Here is the registration link if you’re interested in attending. This meeting will be a free format discussion on all things scalable, so if you have any questions about a new project or experiences (good or bad, the latter being more entertaining) you’d like to discuss among your peers this is a good opportunity to do so. I should be at this meeting as well.

Update: Due to the weather the Boston SUG meeting has been postponed.

In the virtual world we have a new LinkedIn Coherence Users group that has attracted over 30 members on its first day! If you’re a Coherence user or are interested in networking with Coherence users and architects, feel free to join this group.

While I’m in NY for the SIG, I’m going to try to take some time to check out Joel’s new downtown office.

Written by Patrick Peralta

January 26th, 2009 at 6:02 pm

Log file management in Coherence using Log4J

with 6 comments

By default Coherence logs to stdout, which means that Coherence applications deployed in a container will have these logs managed by said container (including rolling of the logs to keep the files from getting too large.) However, many Coherence grids contain JVMs that run the Coherence cache server process (DefaultCacheServer) which means that managing logs becomes an exercise for the developer or operations person.

An easy solution is simply to indicate the name of the file that Coherence should log to like this:


This is by far the simplest approach; unfortunately this means that the log will grow as long as the JVM is alive. For cache servers that have months (or years) of uptime, this will at best result in very large log files and at worse running out of disk space on the volume (not to mention if the volume happens to be the one the OS is running on.) To solve this problem, the most common approach is to use Log4J to manage the logs generated by Coherence.

Here is an example log4j.properties file that could be used for this purpose:

log4j.rootLogger=debug, file
  • In my example I chose to use the DailyRollingFileAppender. The RollingFileAppender which rolls logs over by size can also be used.
  • Note that the ConversionPattern is very simple; it only includes the log message and a newline character. This is because Coherence already prints out the timestamp, version, thread, and other information on each line.
  • The log file name is coherence-${pid}.log. The ${pid} is a system property that will contain the process id of the cache server (see script below.)

Here is the script that I used to launch the cache server:

exec java -Dtangosol.coherence.log.level=6 -Dtangosol.coherence.log=log4j \
-Dpid=$$ -cp [...] com.tangosol.net.DefaultCacheServer

Note that I am using -Dtangosol.coherence.log.level to choose the log level. The log level (debug, info, warn) can also be selected using the Log4J configuration, although using the Coherence system property provides finer grained control. The script also sets the pid system property.

Using this technique, the logs generated by Coherence are rolled, making it much easier to archive logs and (if required) to upload them to support.

Written by Patrick Peralta

January 14th, 2009 at 11:10 pm

Posted in Development