SHARE
Facebook X Pinterest WhatsApp

The OutRider Computing Journal: Creating a Log Class in Perl

Written By
thumbnail
Web Webster
Web Webster
Nov 11, 2000

“One recurrent theme in my job as a database
administrator/assistant systems administrator/systems analyst is
the need to keep track of what happened on the systems while I
wasn’t watching. What did the cron job do last night. What did all
those spooler daemons do while I was at lunch? In other words
logging. It bothered me that there was a lack of simple tools for
doing such a simple, redundant job. So, I set out to do build some
myself. My systems programming tool of choice is Perl, so, that is
language I chose for the project. This journey took me out of my
normal routine of straight-line Perl programming and dumped me in
the land of Modules and Object Oriented Perl. I’m glad to say it
didn’t overwhelm me and in fact I found it rather easy to
write.”

“My first order of business was to take my old standby logging
routines and objectify them. I had several concise routines that I
would either import into the main package through a use statement
or just simply copy/paste depending on my mood and what I was
doing. They consisted of four routines: start_logging,
stop_logging, restart_logging and log.”

“This was quick and dirty code that, while it did the job, was
not very simple to use. For example, if I needed to redirect the
output of a sub-process to the log file I would have to say:
stop_logging(), then run that process and redirect its output to
the log then restart_logging() again. It was Rather clumsy and
difficult to document. So, I set about to rewrite the routines in
an object oriented manner. I followed the ‘Three little rules’ as
formulated by Larry Wall in the objperl(1) man page and restated by
Damian Conway in his book “Object Oriented Perl”…”

Complete
Story

thumbnail
Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Recommended for you...

Red Hat reveals major enhancements to Red Hat Enterprise Linux AI
sjvn
Oct 22, 2024
How to Find AWS EC2 Instance Type Over SSH (6 Methods)
Benny Lanco
Sep 23, 2024
Crond: Daemon to Execute Scheduled Commands
Rose Hosting Blog
Sep 20, 2024
A Detailed Introduction to Oracle VirtualBox
Senthil Kumar
Sep 19, 2024
Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.