DSL Element: logging{}
The logging sub-element is an optional part of a model element. It controls the logging levels for single components or for the whole model. In order to use the logging feature, components have to obtain and use a logger accordingly.
A logger is an object that allows output handling based on logging levels. Such levels usually indicate the severeness of a message. The Java logging infrastructure supports per default 7 log levels, ranging from FINEST (the lowest priority or importance) to SEVERE (the highest importance). In addition there is a level OFF to turn off logging at all. If a log level is provided, all log message of the same or higher priority are passed to the system and printed out.
The examples below shows the use of the logging. The logging element is part of the model element. It lists the component class names and their associated log levels for a simulation run.
model(classname:"my.model") {
// logging definition
logging {
"StreamFlow" "INFO"
"GwFlow" "CONFIG"
}
}
The component StreamFlow in 'my.model' is assigned the Log level INFO, the GwFlow component will have a finer grained CONFIG log level. The default log level for all other components in the model is WARNING.
model(classname:"my.model") {
logging (all:"INFO"){
"StreamFlow" "FINEST"
}
}
Now the default log level for all model components is set to INFO, StreamFlow has the most verbose log level.
model(classname:"my.model") {
logging (all:"OFF")
}
The logging element above turns off all logging for the whole model. In such a configuration, even severe problems within components are not reported. This statement should be used with care.
Element logging{}
Specification
Name |
logging - assigns log levels to components |
Properties | Description | Value | Required |
all | The base log level for all components in the model | 'OFF', 'SEVERE', 'WARNING', 'INFO', 'CONFIG', 'FINE', 'FINER', 'FINEST' | No (default: WARNING) |
Sub-elements | Description | Type | Default | Occurrences |
<comp name> <log level> | single component log level | <String> 'OFF', 'SEVERE', 'WARNING', 'INFO', 'CONFIG', 'FINE', 'FINER', 'FINEST' | - | zero to many |
Note
- If there is no logging element with a model element, all components will default to the WARNING level.