Operating System - HP-UX
1837976 Members
2395 Online
110124 Solutions
New Discussion

our freopen() output is ending up in syslog ????

 
Daavid Turnbull
Frequent Advisor

our freopen() output is ending up in syslog ????

This is happening on the same machines for which I posted this question:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=716258

I have an application that uses Java 1.4, via JNI from c++, to communicate using XML via https to retrieve data. Because some of the Java applets I was using write to stdout & stderr I use freopen() to collect this output so it can be written to file with the following code fragment:
_________________

// redirect stdout and stderr to files
// Java tends to pump stuff to stdout/stderr
// It can be useful to collect this in files.
attribute = "WLogDir";
getAttributeValue(attribute, value);
if (value.length() == 0)
value = "/tmp"; // Somewhere we know will exist

string tmpFile1 = value + "/WesCCT_out.log";
string tmpFile2 = value + "/WesCCT_err.log";

freopen(tmpFile1.c_str(), "a+", fdopen(1, "a+"));
freopen(tmpFile2.c_str(), "a+", fdopen(2, "a+"));
_________________


Syslog looks as if it is being written to in “overwrite” mode. It is as if our application writes to syslog and syslog writes to its log replacing the characters at the beginning of the line. (Some of the java output includes unformatted XML leading to loooooooong lines.) Time stamps in the logging indicate that the output is concurrent.

The problem is not consistent. It has been observed on most of the machines where this code is installed but not all. This problem does not occur every time with most runs seeing the output going where it is supposed to.

When the output gets written to syslog it does not get written to where it is supposed to .

I anticipated that a problem of this nature would have shown up previously but I could not find anything on the forums.

System: HP-UX B.11.00 U 9000/800
C++ compiler: aCC


What is going o
Behold the turtle for he makes not progress unless he pokes his head out.