Is AUDIT_LEVEL a Perl variable? And if I set it like this:
my $audit_trail = $ENV{AUDIT_LEVEL} || 0;
then when invoked, Perl will automagically print a detailed log, like so? If not what module will help with this?
## LOG ## Process: daily_upd started at 00:30:00 25 Mar 2000 Data source: /data/input/daily.dat Data sink: database customer on server DATA_SERVER (using id 'maint') Input record: D:CUS-00123 Action: Delete Translation: CUS-00123 = database id 2364 Record 2364 deleted successfully Input record: U:CUS-00124:Jones & Co| [etc …] Action: Update Translation: CUS-00124 = database id 2365 Record 2365 updated successfully Input record: I:CUS-01000:Magnum Solutions Ltd| [etc …] Action: Insert Integrity Check: CUS-01000 does not exist on database Record 3159 inserted successfully End of file on data source 1037 records processed (60 ins, 964 upd, 13 del) Process: daily_upd complete at 00:43:14 25 Mar 2000
This is mentioned in the Data munging with Perl book.

2.5.1 What to write to an audit trail.

At different points in the life of a program, different levels of audi +ting will be appropriate. While the program is being developed and tested it is common practice +to have a much more detailed audit trail than when it is being used day t +o day in a production environment. For this reason, it is often useful to write auditing cod +e that allows you to generate different levels of output depending on the val +ue of a variable that defines the audit level. This variable might be read from an envi +ronment variable like this: my $audit_level = $ENV{AUDIT_LEVEL} || 0; In this example we set the value of $audit_level from the environment +variable AUDIT_LEVEL. If this level is not set then we default to 0, the minimu +m level. Later in the script we can write code like: print LOG 'Starting processing at ', scalar localtime, "\n" if $audit_level > 0; to print audit information to the previously opened file handle, LOG. Standards for audit trails will typically vary from company to company +, but some things that you might consider auditing are:  start and end times of the process  source and sink parameters (filenames, database connection parameter +s, etc.)  ID of every record processed  results of each data translation  final count of records processed

In reply to AUDIT_TRAIL in Data Munging with Perl by mikejones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.