user tracking

Unanswered Question
Oct 6th, 2008
User Badges:

Hello! I have a script to pull information from UT database. my cron-job log file showing the error the very common log4j. my question is not about log4j. but I would like added a time stamp on my log. I know all CiscoWorks log has times stamp. but my log doesn't have. any body can solve the same problem how to added a time stamp on perl script to know when exactly the error occur.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Joe Clarke Mon, 10/06/2008 - 10:35
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

print LOG scalar localtime, ': ', $msg, "\n";

eliaspaulos Mon, 10/06/2008 - 11:26
User Badges:

thank you so much J. this line can be added on any line of my script? or at the end or at beginning?and either a space between ,':', or all flat!! once again thank you!!

Joe Clarke Mon, 10/06/2008 - 12:21
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

This line prints out the value of the variables $msg preceded by the current timestamp. You would use this line to log a line to your script's logfile. It assumes the logfile handle is called LOG.

Actions

This Discussion