Skip to content
cihub edited this page Dec 14, 2011 · 21 revisions

File

Function: writes received messages to a file

Element name: file

Allowed attributes:

  • formatid - format that will be used by this receiver
  • path - path to the log file

Example:

<sealog>
    <outputs>
        <file path="log.log"/>
    </outputs>
</sealog>

Console

Function: writes received messages to std out

Element name: console

Allowed attributes:

  • formatid - format that will be used by this receiver

Example:

<sealog>
    <outputs>
        <console/>
    </outputs>
</sealog>

Rolling file writer (or "Rotation file writer")

Function: writes received messages to a file, until date changes or file exceeds a specified limit. After that the current log file is renamed and writer starts to log into a new file. If you roll by size, you can set a limit for such renamed files count, if you want, and then the rolling writer would delete older ones when the files count exceed the specified limit.

Element name: rollingfile

Allowed attributes:

  • formatid - format that will be used by this receiver

  • filename - path to the log file. On creation, this path is split into folder path and actual file name. The latter will be used as a common part for all files, that act in rolling:

    • In case of 'date' rolling, the file names will be formed this way:
       time.LocalTime().Format(rollFileWriter.datePattern)+" "+rollFileWriter.fileName)
    • In case of 'size' rolling, the file names will be formed this way: "filename.#". For example: app.log, app.log.1, app.log.2, app.log.3, ...
  • type - rotation type: "date" or "size"

  • maxrolls - an attribute used only with type="size". Maximal count of renamed files. When this limit is exceeded, older rolls are removed. Should be >= zero.

  • maxsize - an attribute used only with type="size". This is the size limit exceeding which results in a roll.

  • datepattern - an attribute used only with type="date". This is the pattern that would be used in 'time.LocalTime().Format' to form a file name. The "date" (actually, this means both date & time) rolling occurs when 'time.LocalTime().Format(rollFileWriter.datePattern)' returns something different than the current file name. This means that you create daily rotation using a format with a day identifier like "02.01.2006". Or you can create an hourly rotation using a format with an hour identifier like "02.01.2006.15".

Important: Do not use any special symbols that are not allowed in filenames.

Example:

<sealog>
    <outputs>
        <file path="log.log"/>
    </outputs>
</sealog>
Clone this wiki locally