LogEntitySuffixed
From MARIEWiki
[edit]
Description
This LogEntity specialized the LogEntityDataFactory. Its goal is to change the filename for the journalize of a tag during a process. You could :
- Add a numeric suffix to your file name like : filename0, filename1... This suffix will be increment to each configuration in the process (see below).
- Add a custom suffix like : filenameCustomSuffix
When you want change the filename, you must reconfigure the logger of the tag wanted with this command :
MARIE_LOG_CONFIGURE(const std::string& tag, const std::string& customConfig)
- tag : This is the tag you want to modified. Necessarily, it must be associate to a LogEntitySuffixed.
- customConfig :
- If empty ("") :
- If you use numeric suffix, the suffix will be increment and a new file will be create with this new filename.
- If you don't use numeric suffix, nothing will be changed.
- if not empty : A new file will be create with this suffix : customConfig.
- If empty ("") :
[edit]
Configuration
Note : see Configuration Description Language for syntax details.
! T logEntity
# KV name
# KV type = LogEntityDataSuffixed
# KV baseName
# KV extension
# KV initialSuffix
# KV numericSuffix
o KV protocolID
o KV minlevel
# Q appenderList
! T appender
# KV name
# KV type = file
# KV filename
o KV append
o T layout
o KV type = pattern
# KV conversionPattern
The filename is like : baseName suffix . extension
- name : Specify a name for the logEntity create. This name is also used for the name of log4cxx logger create.
- type : Specify the type of logEntity used : LogEntityDataSuffixed
- baseName : Specify the base name of the files create.
- extension : Specify the extension of the file create.
- numericSuffix : Specify if the suffix will be numeric or not.
- initialSuffix : Specify the initial suffix. If numeric, it's the first value from which the incrementation will be done.
- protocolID : Specify the protocol desired when you log DataAbstract : MARIETAB,MARIEPRETTY,MARIEXML. (MARIETAB by default).
- minlevel : Specify the level minimum wanted to journalize your log : all, debug, info, warn, error, fatal (info by default).
- appenderList : regroups all the different format of output need for this log entity (console, file).
- name : Specify the name of the appender.
- type : Specify where the log must be journalize. In this log Entity it must be : file
- filename : Specify the filename where the log must be journalize. Called it like the first file will be create (ex : baseName0.extension). Otherwise an empty file will be create.
- append : If true, if the file already exist, the file will be appended to. Otherwise, the file will be truncated before being opened. (false by default).
- layout : Specify the visual format of the log.
- type : Specify the type of layout used : pattern or mariePattern. The most common is mariePattern. It offers the same possibility as pattern but you could handle the tag too (pattern by default).
- conversionPattern : Structure of the log ([%-5p] [%c] %15d{%X.%Q} | %m%n by default) (see: Layout).
[edit]
Example
<logEntity elem="type">
<name elem="kv">MyLogEntity</name>
<type elem="kv">LogEntityDataFactory</type>
<protocolID elem="kv">MARIEPRETTY</protocolID>
<minLevel elem="kv">info</minLevel>
<appenderList elem="q">
<appender elem="type">
<name elem="kv">A1</name>
<type elem="kv">file</type>
<filename elem="kv">./log/MyLog.txt</filename>
<createDirectory elem="kv">true</createDirectory>
<preserveExistingFile elem="kv">true</preserveExistingFile>
<layout elem="type">
<type elem="kv">mariePattern</type>
<conversionPattern elem="kv">[%20T] [%T] [%m] [%m]%n</conversionPattern>
</layout>
</appender>
</appenderList>
</logEntity>

