LogBox DSL
As we have seen the LogBox DSL can be used in different contexts:
Portable CFC with a
configure()
method in alogbox
variableColdBox config inside the
configure()
method in alogbox
variableA struct literal sent in to the constructor of LogBox
NO matter how you dice it, it's the same LogBox Config DSL:
Base Config
Root level configuration keys.
Key | Description |
| A structure where you will define appenders |
| A structure where you will configure the root logger |
| A structure where you can define granular categories (OPTIONAL) |
| An array that will hold all the category names to place under the DEBUG logging level (OPTIONAL) |
| An array that will hold all the category names to place under the INFO logging level (OPTIONAL) |
| An array that will hold all the category names to place under the WARN logging level (OPTIONAL) |
| An array that will hold all the category names to place under the ERROR logging level (OPTIONAL) |
| An array that will hold all the category names to place under the FATAL logging level (OPTIONAL) |
| An array that will hold all the category names to not log at all (OPTIONAL) |
Appenders
To define an appender you must define a struct with a key value which is the internal name of the appender. Each appender's name must be unique. You configure each appender with the following keys:
Key | Description |
---|---|
| The class path of the appender |
| The properties struct for the appender (OPTIONAL) |
| The layout class path of the layout object to use (OPTIONAL) |
| The numerical or English word of the minimal logging level (OPTIONAL, defaults to 0 [FATAL]) |
| The numerical or English word of the maximum logging level (OPTIONAL, defaults to 4 [DEBUG]) |
Root Logger
To configure the root logger, use the following keys:
Key | Description |
| The numerical or English word of the minimal logging level (OPTIONAL, defaults to 0 [FATAL]) |
| The numerical or English word of the maximum logging level (OPTIONAL, defaults to 4 [DEBUG]) |
| A string list of the appenders to use for logging or the |
| A string list of appenders to exclude from logging. |
Categories
To define categories, you define a struct with a key value, which is the internal name of the category. Each category name must be unique,. You configure each category with the following keys:
Key | Description |
| The numerical or English word of the minimal logging level (OPTIONAL, defaults to 0 [FATAL]) |
| The numerical or English word of the maximum logging level (OPTIONAL, defaults to 4 [DEBUG]) |
| A string list of the appenders to use for logging (OPTIONAL, defaults to *) |
| A string list of appenders to exclude from logging. |
As you might notice, the names of the keys on all the structures match 100% to the programmatic methods you can also use to configure logBox. So, when in doubt, refer back to the argument names.
Example Configuration
Last updated