For more information... RTFM!

You are not logged in

Powered by Interchange version 5.7.0


Write text to a file.


  • [log file] Text to write [/log]

Parameter Description Default
file the name of file to write to. See LogFile
arg Alias for file. None
create Create the file if not present or overwrite the file if it is present. No
hide Suppress status otherwise returned by tag to the page. No
process Processing (if any) to apply to the content while logging. None
record_delim Record delimiter. ASCII LF
type Log type (see below). error
interpolate Parse Interchange tags, included in the body text, before this container tag executes. No


Tag usage example

[log file="logs/foo" create=1] Text to write to the file [/log]

Perl example

    file => $file,
    body => $body,

or similarly with positional parameters:

$Tag->log($file, $attribute_hash_reference, $body);


This tag writes its body text to the specified file, or to the default file specified using the LogFile parameter.  Interchange markup language tags work inside this container, so it is possible to iterate over a list, using [loop] or similar, and create "records".



The name of file to log to.  If the filename starts with a ">" symbol (i.e. ">filename") then the create parameter will be set true for you.  The leading ">" will not be included in the actual filename, of course.

If not specified, the file named with the LogFile configuration directive, or that directive's default value, will be used.



The given filename must be relative to the website's home directory, as specified using the Catalog global configuration directive.


Set this parameter true to create the file if not present in file system.



If the named file already exists, and create is set true, then this tag will re-create the file and overwrite its content.


If true then suppress the status code that would otherwise be returned to the page.


Processing (if any) to apply to the content while logging.

Currently, the only valid value for the process parameter is "nostrip".  The following will not strip leading/trailing whitespace and will not convert DOS-style CRLF line endings to proper LF characters:

[log file="logs/mylog.log" process="nostrip"] text to write to the file [/log]


Record delimiter.  Defaults to an ASCII LF, so each block of logged text, or other data, appears on its own line.


The type of log to create/write.  Any of the following three types may be specified:

Type Description
error Add Interchange error formatting and time/location stamps.
quot Delimited entries.
text Ordinary text file.

The default log type is "error".

Category:  Interchange tags
Last modified by: Gert van der Spoel
Modification date: Sunday 5 July 2009 at 9:20 AM (EDT)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us