Command line utility logtext
Navigation: Diese Seite in Deutsch - Main page - Contents
| Download program or batch file | Operating system | Description |
| LogTextSetup.exe
LogText.zip Version from 2006-11-03 |
Windows
(95/98/ME/ NT/2000/XP) |
Logtext is a command line utility that logs text lines into log files.
A date and time stamp according to ISO8601
including a time zone offset precedes each logged line, which is written
into a file with the given name. Depending on the parameters, the log files'
names can be appended by the current year (yyyy), the current month (yyyy-mm),
the current week (yyyy-Wcw), or the current day (yyyy-mm-dd). The utility
can automatically handle old log files and process them accordingly, i.e.
either delete or compress them by using the gzip library. Additionally
a logfile can be rotated by its file size or the number of text lines it
contains.
Another feature is that the program can read the text to log from standard input, hence you can log the entire output of console programs or batch files. Examples: logtext batchname "We want to log this text." ECHO This example adds a text line to the file named 'batchnameyyyy-mm-dd.log'
in the current directory. The content of the line is 'yyyy-mm-dd +/-timezone
We want to log this text.', where yyyy represents the current year, mm
means the current month, dd refers to the current day of month, and timezone
is the time difference to UTC (Coordinated Universal Time) in 4 digit ISO
format. The parameter ECHO specifies that the text shall be sent to the
standard output as well.
logtext batchname "We want to log this text." ECHO MONTHLY This writes into a file called 'batchnameyyyy-mm.log'. The content of
the text line remains the same.
logtext batchname "We want to log this text." ECHO 10 Creates a new log file daily, but only keeps the files of the last 10
days. Older files are automatically deleted.
logtext batchname "We want to log this text." ECHO 10 10 Keep the log files of the last 10 days. Additionally, keep another 10
logfiles in a compressed (gzip) form, i.e. this invokation keeps 10 days
alltogether, 10 in plain text, the other 10 packed. Even older files are
automatically deleted.
logtext c:\windows\logfiles\batchname "We want to log this text." ECHO 2 20 Put the log files into the folder c:\windows\logfiles, keep 2 uncompressed
and 20 compressed log files.
logtext %SystemRoot%\batchname "We want to log this text." ECHO 2 20 Automatically obtain the system directory from the command interpreter
and put the log files there.
batch.cmd | logtext %SystemRoot%\batchname_ "This text is ignored." ECHO STDIN 2 20 Log the output (no errors) of the command line job batch.cmd into %SystemRoot%\batchname_yyyy-mm-dd.log.
batch.cmd 2>&1| logtext %SystemRoot%\batchname_ "This text is ignored." ECHO STDIN 2 20 Log all output (standard and errors) of the command line job batch.cmd into %SystemRoot%\batchname_yyyy-mm-dd.log. Another good example on how to use the logtext utility is the DeleteTempFolder
script.
Notes: Here is one of the silliest questions I've heard about the logtext utility: "How can I change the date/time format to mm/dd/yy?" Smart answer:
Even smarter answer:
|
Navigation: Diese Seite in
Deutsch - Main page - Contents
---
All scripts (batch files) and programs provided by www.wabel.de.
Wagner Belmer GbR (WaBel)
(C) Thomas Belmer
ASAMnet - - PMView - Allee Parkhotel Maximilian - Autospenglerei Belmer - Email - Thomas's homepage - Bieruhr - Panoramas - Amberg live