LogEntityDataFactory
From MARIEWiki
[edit]
Description
With this log entity you could entirely choose the configuration of your logger. It uses a Marie DataFactory to serialize data when log(std::string tag, DataAbstract& data) is called. Configuration of the LogEntity is similar to the one of log4cxx where you need to configure appender and layout.
See also LogEntityDefaultFile or LogEntityDefaultConsole for inherited LogEntity based on the LogEntityDataFactory
[edit]
Configuration
Note : see Configuration Description Language for syntax details.
! T logEntity
# KV name
# KV type = LogEntityDataFactory
o KV protocolID
o KV minlevel
# Q appenderList
! T appender
# KV name
# KV type
# KV filename
o KV createDirectory
o KV preserveExistingFile
o KV append
o T layout
o KV type = pattern
# KV conversionPattern
- 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 : LogEntityDataFactory
- 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. (warn 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 : console or file
- filename : Specify the filename where the log must be journalize if type = file
- createDirectory : If true, the logger create the directory specified in filename, otherwise not. (false by default)
- preserveExistingFile : If true, the logger check if the file exist. If yes, the filename will be completed by "_XX" where XX correspond to the number of file with the same filename. Otherwise, the filename isn't change. (false by default)
- 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>

