Question

I've created a procedure that writes text to a file yet for some reason I'm not able to create a new line through the code and the end result is that the procedure writes everything to the same line until it breaks to a new line due to size. this is how the code looks:

logFileHand := UTL_FILE.FOPEN('LOGS' , logName, 'A');
UTL_FILE.PUT_LINE(logFileHand, LOG_TS || '   ' || LOG_INSTANCE || '   ' || LOG_USER ||    
'   ' || LOG_PROGRAM || '   ' || LOG_LEVEL || '   ' || LOG_TEXT);
UTL_FILE.PUT_LINE(logFileHand, 'test');
UTL_FILE.FCLOSE(logFileHand);

file looks like this after 1 run of this procedure:

30-DEC-13 03.43.03.341466 PM 1 LPSQL TABLET_PARTY.GETSP TABLET_PARTY.GET ERR SQL Error: 100 Could not find the party details for ID: 200144095test

as you can see everything is on the same line, I've tried every variation of PUT functions and nothing helped. Any ideas? thanks alot in advance!

Was it helpful?

Solution

Your lines appears to be not split because unix-like OS's and windows have different conventions on what is treated as line separator. For more details look at answer to this question. You have two options to get lines properly separated.

  1. Setup your text editor properly. I.e. in Notepad++ you should choose Edit -> EOL Conversion -> Convert to Windows Format. Then save your file and reopen it.
  2. Make your procedure to write log file with Windows line separators. This approach is questionable. If these files are supposed to be used in any way on the server which have linux OS then it should has native format.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top