Considering that you are passing a parameter to the begin function and using it as a key... if you pass anything that's an invalid key, then the begin function will break, which will break the rest of the script.
It would probably be easier/more robust to use objects to accomplish this task.
This way each object is it's own logging session, with it's own instance variables, one of which is a text string indicating the name of the session, the others are the message array, the filehandle and start and stop times.
This allows you great freedom to start and stop multiple logging sessions, and insulates you from having to use specific keys in your scripts to reference those sessions.
It's relatively trivial to convert your code to the object format, but also might be easier to use one of the many pre-existing Log classes and adapt for your use, just search CPAN.
Hello,
I have text files to append and am able to do with cat.
cat file1 file2 >file3
and file3 works fine in UNIX (checked with vi and it looks fine) but when i open the same file in windows I see 2nd file appended as a single-line. In other words, all the lines of 2nd file appended to... (2 Replies)
i have a number of java files containing
eg:
--------------myfile.java--------------
package zip.fun.myfiles;
import java.*
import something..;
import sdfdfdsa;
...
...
--------------------------------------------
Now I need to append / insert a line as follows:
... (10 Replies)
Hi,
I am trying to insert a timestamp after all the file names in a folder,after the timestamp is created in the filename the file size is becoming zero bytes.
please tell me where I am doing it wrong.
I have declared the variable in starting of my script.
timestamp=`date... (1 Reply)
Lets say i have files like the following format :-
R0001.log
R0002.log
...
...
R00011.log
upto R000n.log, there are also a lot of text files with different names
now how can i find these files with in a range, i can do "ls R000*.log" and it will show me all the R000*.log files but what... (2 Replies)
Hi All,
I have a script which i use in office. This script is used to log the work in users name.
For that in the script itself I have added that the infomration should append to the logfile everytime the script is run.
LOGFILE=/data/log/request1.txt
All these days it was... (3 Replies)
I have string named texts which consist of section label “BOOK-SEC-“. Section starts from 1 to n, where n is a number. For this example conside the value of n is 9. That is, the string variable looks like
“BOOK-SEC-1... (2 Replies)
I'm trying to read the output of a .sql script (simple insert and commit oracle pl/slq script) to a log file using a shell script. My problem is I end up with a log file that looks like this:
sd12@phenix97:/detain/sd12/logs > cat 20071205_detain_20071206.log
12320496 rows created. Commit... (11 Replies)
Hi guys,i urgently need help in this problem,i need to append one sentence to another line when it meet a certain word.
For example:
root: root time_last_login = 1191232080 root tty_last_login = /dev/vty0 root host_last_login = rep1nim root unsuccessful_login_count = 0 root... (10 Replies)
ABC:10:A1:ABCA110
ABC:10:A1:ABCA110
ABC:20:A1:ABCA120
DEF:20:D1:DEFD120
GHI:30:G1:GHIG130
GHI:40:G1:GHIG140
JKL:30:J1:JKLJ130
MNO:10:M1:MNOM110
What I'm trying to do is look through a file that consists of four columns (as above). As you can see there are duplicates in
the file, i.e.... (2 Replies)
about 2 months ago i installed mandrake linux 8.0 however due to my current internet setup (dial up upsteam, and cable downstream) i was never able to get it configured properly so i gave up untill i could change to an all cable isp...well that day is tomorrow!!!
what i would like to know is... (1 Reply)