Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Duplicate log messages

807589Oct 23 2008 — edited Oct 23 2008
Hi

I am using the java.util.logging framework and just encountered something strange in code that has been running in production for years.

Basically, a very large series of duplicate records appeared in the log file and we had to kill the process as the log file was getting huge. All log records have a timestamp though, added by the LogFormatter below and the timestamp was identical on all cases. This suggests that this is not an application bug (and remember this has been running OK for years) but a JVM, logging framework or environment issue. The code has just been installed on a new machine too, having worked fine on the old one. And the new system uses a storage area network. No idea if this is significant but I am suspicious of anything different in this environment.

So... apparent looping but the same timestamp on all records. If the application code was looping, calling logger.info repeatedly for example, then the timestamp would change... but it does not, suggesting a lower level issue. maybe.

Does anyone have any experience on this or pointers?

LogFormatter btw:

public String format(LogRecord rec) {
StringBuffer buf = new StringBuffer();
long logTime = rec.getMillis();
Date logDate = new Date(logTime);
String dateTime = (df.format(logDate)+" ").substring(0,23);
buf.append(dateTime);
buf.append(formatMessage(rec));
buf.append('\n');
return buf.toString();
}

// df is a SimpleDateFormatter btw

Thanks in anticipation
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 20 2008
Added on Oct 23 2008
6 comments
1,042 views