[QFJ-318] FileLog for Messages Sometimes Omits Endline Between Messages Created: 27/Jun/08  Updated: 29/Sep/16  Resolved: 01/Jul/08

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.3.1
Fix Version/s: 1.3.2

Type: Bug Priority: Default
Reporter: Robert Reyes Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Environment:

Red Hat SE 5 Linux


Issue Links:
Relates
is related to QFJ-677 The fix for QFJ-318 was reverted (ina... Closed

 Description   

The .messages log file does not show the endline between two distinct FIX messages. You'll notice that the field delimiter does show up after tag 10 in the first message, but then the second message is appended onto it without a new line being started.

20080626-15:42:19.969: 8=FIX.4.2☺9=208☺35=G☺34=429600☺49=SENDER☺52=20080626-15:42:19.969☺56=TARGET☺1
1=428918☺21=1☺38=5000☺40=2☺41=428899☺44=67.26☺54=1☺55=VBK☺60=20080
626-15:42:19.969☺100=ARCA☺111=1000☺115=SENDER☺10=251☺20080626-15:42:19.969: 8=FIX.4.2☺9=238☺35=8☺49
=SENDER☺56=TARGET☺34=432761☺52=20080626-15:42:19☺128=TARGET☺20=0☺17=76☺38=2700☺40=2☺44=26.7
5☺54=1☺55=EWA☺37=58☺32=200☺31=26.74☺14=1300☺6=26.74☺39=1☺151=1400☺60=20080626-15:42:19☺150=
1☺11=687☺59=0☺10=127☺



 Comments   
Comment by Robert Reyes [ 27/Jun/08 ]

It turns out that this is due to FileLog.java not synchronizing on the writeMessage method. After the two messages that printed together were finished, I saw an empty line print out.

Comment by Jörg Thönnes [ 28/Jun/08 ]

Ideally, file append mode and atomic writes should be used here. In UNIX, this would be the O_APPEND mode
and exactly on write() system call with the complete line. Then the OS will ensure, that the complete line is written
onto the end of the file.

Using synchronized writeMessage() is the second best alternative, IMHO.

Comment by Steve Bate [ 01/Jul/08 ]

The tradeoff is between creating more temporary objects to prebuild the complete log text before calling write() or to synchronize the writeMessage method. It seems to me that the synchronization might be less overall impact on performance than creating an extra temporary object for log write.

Generated at Sat Nov 23 07:27:26 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.