Front End Logging (tail -f stuff)

Entering a new coding environment (working in a national company), I’ve got several things learned.

One of the important is that I have to take care of every logging activities. It means that people needs me to write any transaction (success, fail, or error) to a flat file.

After my application’s been launching live, the “operation people” can check the log file for any transaction activities using unix command :

tail -f <log_file>

hmmmm…

Rather than supply them with backend checking, I’d prefer to make it (checking log file) into frontend using php.

Here’s the code I scratch to “tail” the log file in FrontEnd :

<html>
<head>
<script language="javascript">
setInterval ( "window.scrollBy(0,100)", 5 );
</script>
</head>
<body>
<a href="http://localhost/tesapps">Click</a>
<?
if(!empty($_GET))
{
$page = $_GET[log]; //supply this GET variable with path to log file
system("tail -f $page");
}
else
echo "<h1>Please provide log file to read !</h1>";
?>
</body>
</html>

With this code, I can simulate tail activities in web browser

nice, huh?đŸ™‚

Tags: , , , ,

About sisusilo

I was born after we celebrate youngman promise about their commitment to this country

2 responses to “Front End Logging (tail -f stuff)”

  1. anggriawan says :

    scriptnya gak aman tuh..

  2. antonrifco says :

    hooh pak
    tapi dibuat supaya bisa diakses dari IP tertentu doang

    *shortcut doang sih, haha

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: