DSL KeywordsdebugYou can use the debug keyword to enable or disable internal debugging of log4net. usage: debug = true thresholdYou can use the threshold keyword to set the global threshold that log4net should use, the logging levels are discussed in the identifiers section. usage: threshold = FATAL add_appenderadd_appender is used to add a particular appender to be appended to by zero or more logs. You need to supply the add_appender with a name and the appender type. usage: add_appender @myAppender, ConsoleAppender You can also set values on appenders using properties or method calls by adding statements in the appender block: add_appender @myAppender, ConsoleAppender:
Target = "Console.Error"log_forlog_for is used to add a log using a name identifier, normally you would assign the appenders to the log and set the level, these have been omitted. usage: log_for 'root':
passwith_appenderswith_appenders allows you to choose which appenders you want to use for the log being defined. usage: log_for 'root':
with_apppenders:
@myAppender
@myOtherAppenderat_levelat_level allows a specific level to be set for the log being defined. usage: log_for 'root':
with_appenders:
@myAppender
at_level FATALignore_inherited_appendersignore_inherited_appenders specifies that the log being defined should not inherit any appenders from it's ancestors. usage: log_for 'com.foo.bar':
with_appenders:
@myAppender
ignore_inherited_appendersenvironment_variableenvironment_variable is a shortcut to be able to return a defined environment variable. usage: path = environment_variable 'TEMP'
add_appender @myAppender, FileAppender:
File = "${path}\log.txt"DSL IdentifiersLog LevelsBecause assigning logging level's is a common occurance when configuring log4net they are first class identifiers in log4net.altconf, and include the following: - FATAL
- DEBUG
- INFO
- ERROR
- VERBOSE
- WARNING
These identifiers are used for the threshold and at_level keywords. And everything else Boo has on offer!Because log4net.altconf is a DSL built on top of Boo you can also use valid Boo statements, expressions etc. this gives you more than just the declarative syntax above, you can also leverage the power of Boo to help configure log4net.
|