public LoggingProperties get_logging_properties ( Logger logger , Database db ) { //- Instanciate the returned value LoggingProperties properties = new LoggingProperties ( ) ; //- Check input if ( logger == null ) { return properties ; } try { //- Be sure the specified Database is valid if ( db == null ) { return properties ; } //- Get logging properties from database String [ ] prop_names = new String [ 4 ] ; //- Logging path property (overwrites env. var) prop_names [ 0 ] = "logging_path" ; //- Logging file rolling threshold property prop_names [ 1 ] = "logging_rft" ; //- Logging level property prop_names [ 2 ] = "logging_level" ; //- Logging target property prop_names [ 3 ] = "logging_target" ; //- Get properties from db DbDatum [ ] db_data = db . get_device_property ( logger . getName ( ) , prop_names ) ; //- Set logging path if ( db_data [ 0 ] . is_empty ( ) == false ) { properties . logging_path = db_data [ 0 ] . extractString ( ) ; } //- Set logging rft if ( db_data [ 1 ] . is_empty ( ) == false ) { properties . logging_rft = db_data [ 1 ] . extractLong ( ) ; } if ( properties . logging_rft < LOGGING_MIN_RFT ) properties . logging_rft = LOGGING_MIN_RFT ; else if ( properties . logging_rft > LOGGING_MAX_RFT ) properties . logging_rft = LOGGING_MAX_RFT ; //- Set logging level (if not set from cmd line) if ( db_data [ 2 ] . is_empty ( ) == false ) { String level_str = db_data [ 2 ] . extractString ( ) ; properties . logging_level = tango_to_log4j_level ( level_str ) ; } //- Get logging targets (will be set later) if ( db_data [ 3 ] . is_empty ( ) == false ) { properties . logging_targets = db_data [ 3 ] . extractStringArray ( ) ; } } catch ( java . lang . Exception e ) { //- ignore any exception e . printStackTrace ( ) ; } return properties ; }
Reads logging properties from TANGO database