My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 14, 2008 by michaelacromwell
Labels: Phase-Implementation, Phase-Deploy
DslKeywordsIdentifiers  

DSL Keywords

debug

You can use the debug keyword to enable or disable internal debugging of log4net.

usage:

debug = true

threshold

You 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_appender

add_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_for

log_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':
    pass

with_appenders

with_appenders allows you to choose which appenders you want to use for the log being defined.

usage:

log_for 'root':
    with_apppenders:
        @myAppender
        @myOtherAppender

at_level

at_level allows a specific level to be set for the log being defined.

usage:

log_for 'root':
    with_appenders:
        @myAppender
    at_level FATAL

ignore_inherited_appenders

ignore_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_appenders

environment_variable

environment_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 Identifiers

Log Levels

Because assigning logging level's is a common occurance when configuring log4net they are first class identifiers in log4net.altconf, and include the following:

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.


Sign in to add a comment
Hosted by Google Code