Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A simple log file format

I'm not sure if it was asked, but I couldn't find anything like this.

My program uses a simple .txt file for log purposes, It just creates/opens a file and appends lines.

After some time, I started to log quite a lot of activities, so the file became too large and hardly readable. I know, that it's not write way to do this, but I simply need to have a readable file.

So I thought maybe there's a simple file format for log files and a soft to view it or if you'd have any other suggestions on this question?

Thanks for help in advance.

UPDATE:

It's access 97 application. I'm logging some activities like Form Loading, SELECT/INSERT/UPDATE to MS SQL Server ... The log file isn't really big, I just write the duration of operations, so I need a simple way to do this.

The Log file is created on a user's machine. It's used for monitoring purposes logging some activities' durations.

Is there a way of viewing that kind of simple Log file highlighted with an existing tool?

Simply, I'd like to:

1) Write smth like "'CurrentTime' 'ActivityName' 'Duration in milliseconds' " (maybe some additional information like query string) into a file.

2) Open it with a tool and view it highlighted or somehow more readable.

ANSWER: I've found a nice tool to do all I've wanted. Check my answer.

LogExpert

like image 696
hgulyan Avatar asked May 11 '10 11:05

hgulyan


People also ask

What is the format of a log file?

The JSON (JavaScript Object Notation) is a highly readable data-interchange format that has established itself as the standard format for structured logging. It is compact and lightweight, and simple to read and write for humans and machines.

What is log file with example?

A log file is a computer-generated data file that contains information about usage patterns, activities, and operations within an operating system, application, server or another device, and is the primary data source for network observability.

What is the difference between .log file and a .txt file?

Both files are plain text file. The difference is that . log files are typically generated automatically for example by some software, while . txt files are created by user for example in a word processor.


1 Answers

The 3 W's :

When, what and where.

For viewing something like multitail ("tail on steroids") http://www.vanheusden.com/multitail/

or for pure ms windows try mtail http://ophilipp.free.fr/op_tail.htm

And to keep your files readable, you might want to start new files when if the filesize of the current log file is over certain limit. Example:

  • activity0.log (1 mb)
  • activity1.log (1 mb)
  • activity2.log (1 mb)
  • activity3.log (1 mb)
  • activity4.log (205 bytes)
like image 105
zaf Avatar answered Sep 25 '22 06:09

zaf