Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging information into file

Status
Not open for further replies.

Outy

Programmer
Feb 7, 2001
16
BE
Hi,
I want to log some information into a file and it works fine but it keeps writing on the same line in the loggingfile. The "\n" doesn't work for some reason. How can I solve this problem?

Here is the code:

MonitorLogging.logInformation("Connection to QueueManager "+QMgrName+" succeeded" +"\n");

Thanx
Outliner
 
is it possible the \n is being stripped from the string contents? is there a flush method to force the content into the log file?
 
Hi Outliner,

Perhaps you would like to paste more codes onto the forum? It is quite difficult to see what is causing the problem.

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
What do you mean that the \n doesn't work? Are you trying to view this file using Windoze? If so, you need to add environment specific EOL markers (\n for unix/mac, \r\n for windows). You can dynamically get this by using

String endl = (String)System.getProperty("line.separator");

Then use
MonitorLogging.logInformation("Connection to QueueManager "+QMgrName+" succeeded" + endl);

If this didn't answer the question, lemme know.

Charles
meadandale@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top