Diese Seite in Deutsch
Logtext - Documentation - Command line utiltiy
Home - Download - Documentation - Forum - Bug Report - Contact - License Agreement - External Links
 
 
 
 
Command line utiltity Logtext.exe
 
Installation
 
An installation is not necessary. Simply copy the file LOGTEXT.EXE into the Windows system directory (usually C:\Windows\System32 or C:\Winnt\System32), or use the installation program from the download page which will copy it there automatically.
Actually, you can copy it into any other folder on your system, but make sure that it is within the path environment variable. If you need LOGTEXT.EXE only for one particular program/batch file, then you might consider putting it only into this program's/batch file's directory. Best practise in most cases is, however, to leave a copy in the Windows system folder. This way you can be sure that it's accessible from anywhere on the system, and you don't have to bother about its location. The Windows system directory is in the path environment variable by default.
 
 
Invocation
 
Invoke Logtext.exe On the command line, i.e. in a command line window, type logtext or logtext|more, then press the enter key. Logtext will come up with the output below. Parameters and options are pretty much self-explanatory. See the examples section further down for more information.  
 
Interface for LogText 1.6.21 - built 2007-12-28 19:26:20
Obtain latest release from http://www.logtext.de.
Contact: Thomas@Logtext.de

Batch utility to process log files.

USAGE:
	logtext logfile/application text [options] [maxlogs] [maxzips]

PARAMETERS:

Logfile/application
              File name and optional path containing the
              log files. STDOUT sends the output to standard
              output (automatically implies ECHO_ONLY).

Options are one or more of the following:

ECHO               Logs and echoes the text.
ECHO_ONLY          Do not log or rotate, but echo only.
STDERR             Any echoed output is sent to stderr instead of
                    stdout (except for LOGFILE_NAME).
QUICK              No log rotation.
NO_DATE            No date stamp in log file name.
DAILY              Extend logfile name to fileYYYY-MM-DD (default).
WEEKLY             Extend logfile name to fileYYYY-WCW.
MONTHLY            Extend logfile name to fileYYYY-MM.
YEARLY             Extend logfile name to fileYYYY.
LOGNAME_ONLY       Don't log, but show log file's name.
INCLUDE_APP        Include application name in logged text.
LINES              Shrink logfile down to [maxlogs] lines.
SIZE               Shrink logfile down to [maxlogs] octets.
DELETE_LOGS        Delete all log files.
                    (Only works without maxlogs or maxzips.)
DELETE_ZIPS        Delete all compressed log files.
                   ( Only works without maxlogs or maxzips.)
DONT_ZIP           Do not compress log files.
LOGFILE_NAME       Display the log file's name.
TIME_T             Separate date and time by a capital 'T' as
                    mentioned in ISO 8601 instead of a blank.
STDIN              Ignore text but read lines to log from stdin.
USER_ISO_DATE      Set regional settings for date/time to ISO 8601
                    (current user only). Version 1.6 and higher
                    set the long date format as well.
REG_ISO_DATE       Set regional settings for date/time to ISO 8601
                    (as default for all users). Version 1.6 and
                   higher set the long date format as well.
DONT_LOG_ACTIONS   Implies DONT_LOG_DELETION, DONT_LOG_ZIPPING,
                    and DONT_LOG_REGISTRY.
LOG_DELETION       Log deletion of files (default).
LOG_REGISTRY       Log registry changes (default).
LOG_ZIPPING        Log compression of files (default).
DONT_LOG_DELETION  Don't log the deletion of files.
DONT_LOG_REGISTRY  Don't log registry changes.
DONT_LOG_ZIPPING   Don't log compression of files.
DONT_LOG_MS or     Don't add fractions of a second to time stamp
NO_MS              (hh:mi:ss instead of hh:mi:ss.mis).
DONT_LOG_SEC or    Don't add seconds, milliseconds, or offset to
NO_SEC             the time stamp (only hh:mm).
NO_OFFSET or       Don't add the offset to the time stamp.
NO_OFFS
THREE_BLANKS       Insert three blanks instead of just one between
                    date/time stamp and text to log.
KEEP_CRLF          Don't remove CR or LF characters from text.
NTFS_COMPRESS[ION] Use NTFS's internal compression instead of gzip.
/EE=module         External packer's executable module.
/EP=pars           External packer's command line parameters.
                    %1 will be replaced with the log file's name,
                    %2 with the archive's name.
/EX=.ext           External packer's preferred archive file name
                    extension.


maxlogs       Only keep this amount of log files.
              Defines the minimum number of octets or lines,
              if LINES or SIZE is given.
maxzips       Only keep this amount of compressed log files.
              Defines the maximum number of octets or lines,
              if LINES or SIZE is given.

EXAMPLES:

logtext STDOUT "Logtext built."
              Output:
              2007-12-28 19:26:20.044+01:00 Logtext built.

logtext STDOUT "Logtext built." DONT_LOG_MS
              Output:
              2007-12-28 19:26:20+01:00 Logtext built.

logtext STDOUT "Logtext built." NO_MS NO_OFFSET
              Output:
              2007-12-28 19:26:20 Logtext built.

logtext c:\temp\application "Text to log" ECHO 2
              Log daily, keep 2 uncompressed log files.

logtext c:\temp\application "Text to log" ECHO 2 10
              Log daily, keep 2 log files and 10 compressed files.

logtext application "Text to log" ECHO NO_SEC THREE_BLANKS
              Produces output compatible to Inno Setup's installation
              log files (see http://www.innosetup.org).

logtext application "Text to log" MONTHLY SIZE 1000000.
              Log monthly, maximum size of logfile is 1000000
              octets, suppress output.

logtext application "Text to log" WEEKLY LINES 100 200.
              Log up to 200 lines in a weekly logfile. If the
              amount of logged lines exceeds 200, remove the least
              recent lines so that a minimum of 100 lines remain.

logtext app "Text" "/EE=zip.exe" "/EP=-9 %2 %1" /EX=.zip 2 2
              Keep 2 uncompressed and 2 compressed log files,
              use zip.exe as an external packer by invoking it
              with 'zip.exe -9 app.log.zip app.log'.

batchfile.bat | logtext application "" ECHO STDIN
              Log output (standard output only) of batchfile.bat.

batchfile.bat 2>&1| logtext application "" ECHO STDIN
              Log output (stderr and stdout) of batchfile.bat.

logtext STDOUT "Registry set." USER_ISO_DATE REG_ISO_DATE
              Set registry values for the operating system to use
              ISO 8601 date/time instead of local format. Don't
              write into a log file.
	
Examples
 
Store data and time in environment variables.
 
Here's an example how to store date and time within a batch file into environment variables. In contrary to pure Windows tools this method is completely independent of the configured formats of date and time. If Logtext is installed, this batch file will work on any Windows system, starting with Windows NT. It will of course not work on Windows 95, Windows 98, or Windows ME, because of the 'FOR' loop.
 
You can download the file from here (isodatetime.cmd).
@ECHO OFF
LOGTEXT stdout "" ECHO_ONLY
FOR /F "eol=; tokens=1-9,* delims=-:.+ " %%a IN ('LOGTEXT stdout "" ECHO_ONLY') DO (
	SET iYear=%%a
	SET iMonth=%%b
	SET iDay=%%c
	SET iHour=%%d
	SET iMin=%%e
	SET iSec=%%f
	SET iMis=%%g
	SET iOfH=%%h
	SET iOfM=%%i
)
ECHO.
ECHO isodatetime - Example for LOGTEXT.EXE
ECHO  See http://www.logtext.de for more info.
ECHO.
ECHO Date:     %iYear%-%iMonth%-%iDay%
ECHO.
ECHO Year:     %iYear%
ECHO Month:    %iMonth%
ECHO Day:      %iDay%
ECHO.
ECHO Time:     %iHour%:%iMin%:%iSec%.%iMis%
ECHO.
ECHO Hour:     %iHour%
ECHO Minute:   %iMin%
ECHO Second:   %iSec%
ECHO Fraction: %iMis%
ECHO.
ECHO Offset to UTC: %iOfH% hours and %iOfM% minutes.
ECHO.
	
 
 
External links
 
Logtext examples at http://www.knaggs.de
 
 
 
 
 
 
 
 

Home - Download - Documentation - Forum - Bug Report - Contact - License Agreement - External Links
Diese Seite in Deutsch