Need help to develop a log file in Perl
--90e6ba6135944b737604a1d36d0f
Content-Type: text/plain; charset=ISO-8859-1
I have different Web based scripts when they run update SQL Data Base. Now I
need to audit every update sql in my database and store all logs to data
file.
I dont mind about size of a file since I will create different file foreach
item Audited. I will be writing to a file username, date/time, item changed
regards
Khabazela
http://www.greenitweb.co.za
--90e6ba6135944b737604a1d36d0f--
Re: Need help to develop a log file in Perl
At 4:49 PM +0200 4/26/11, Khabza Mkhize wrote:
>I have different Web based scripts when they run update SQL Data Base. Now I
>need to audit every update sql in my database and store all logs to data
>file.
>I dont mind about size of a file since I will create different file foreach
>item Audited. I will be writing to a file username, date/time, item changed
Check out the open, print, printf, and close functions.
To create a new file or overwrite an existing file, use the
three-argument version of open:
open( my $outh, '>', $filename) or die("Can't open $filename for writing: !$");
where $filename is a string variable containing the name of your file.
If you want to append to an existing file (or create it if it doesn't
exist), use '>>' for the second argument:
open( my $outh, '>>', $filename) or die("Can't append to $filename: !$");
See:
perldoc -f open
perldoc -f print
perldoc -f printf
perldoc -f close
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: Need help to develop a log file in Perl
--bcaec51a8f984bc0ec04a1d70b69
Content-Type: text/plain; charset=ISO-8859-1
Mornin' --
You might check Log::Log4perl on CPAN. It will most likely do what you want
might out of the box (the Easy Mode) and will make your life a lot easier
by taking care of such 'trivia' as time-stamps, severity-levels, etc.
B
On Tue, Apr 26, 2011 at 7:49 AM, Khabza Mkhize <khabza.dev [at] gmail.com> wrote:
> I have different Web based scripts when they run update SQL Data Base. Now
> I
> need to audit every update sql in my database and store all logs to data
> file.
> I dont mind about size of a file since I will create different file foreach
> item Audited. I will be writing to a file username, date/time, item changed
>
> regards
> Khabazela
> http://www.greenitweb.co.za
>
--
Bob Goolsby
bob.goolsby [at] gmail.com
--bcaec51a8f984bc0ec04a1d70b69--