Web Development

General discussion


Analyze your log files in reverse

By Mark W. Kaelin Editor ·
The Jan 8, C++ TechMail discusses reversing logs to make your debugging easier. What methods do you use to analyze logs when debugging your applications?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Shorter solutions for reversing files

by cesar_duenas In reply to Analyze your log files in ...

If all you want is print a text file in reverse order, there are much simpler solutions:

In Unix, simply use:

tail -r mylogfile.log

A Perl script offers a more general solution

perl -e 'print reverse <>' mylogfile.log

Much better than a 100+ lines of C++ code!


Cesar Duenas

Collapse -


by John Torjo In reply to Shorter solutions for rev ...

You're right.

However, it can be compiled, and passed on to somebody else without needing any other interpreter (or the like) to be running on the other computer. It's especially useful for Win32 systems.

You could consider this as an example of using STL streams!


Collapse -


by lmolina_oops In reply to True

I wrote a utility where I needed just the last
3000 of some "log" files. It was for a Windows
consolole tool, and in that environment you can depend on Unix toos or Perl binaries to be around.
You definitely would like something like this to be available. Although, I used one provided to me by other developer, written in "C", very fast indeed.

Related Discussions

Related Forums