diff options
Diffstat (limited to 'tosca2heat/heat-translator/translator/conf')
-rw-r--r-- | tosca2heat/heat-translator/translator/conf/config.py | 9 | ||||
-rw-r--r-- | tosca2heat/heat-translator/translator/conf/heat_translator_logging.conf | 43 |
2 files changed, 52 insertions, 0 deletions
diff --git a/tosca2heat/heat-translator/translator/conf/config.py b/tosca2heat/heat-translator/translator/conf/config.py index 4e8fe87..52ac458 100644 --- a/tosca2heat/heat-translator/translator/conf/config.py +++ b/tosca2heat/heat-translator/translator/conf/config.py @@ -12,6 +12,7 @@ # under the License. ''' Provide a global configuration for the TOSCA translator''' +import os from six.moves import configparser @@ -65,3 +66,11 @@ class ConfigProvider(object): raise exception.ConfSectionNotDefined(section=section) return values + + @classmethod + def get_translator_logging_file(cls): + conf_file = '' + CONF_FILENAME = 'heat_translator_logging.conf' + conf_path = os.path.dirname(os.path.abspath(__file__)) + conf_file = os.path.join(conf_path, CONF_FILENAME) + return conf_file diff --git a/tosca2heat/heat-translator/translator/conf/heat_translator_logging.conf b/tosca2heat/heat-translator/translator/conf/heat_translator_logging.conf new file mode 100644 index 0000000..e01a889 --- /dev/null +++ b/tosca2heat/heat-translator/translator/conf/heat_translator_logging.conf @@ -0,0 +1,43 @@ + +[loggers] +keys=root,heat-translator + +[handlers] +keys=RotatingFileHandler,SysLogHandler,NullHandler + +[formatters] +keys=form01 + +[logger_root] +level=DEBUG +handlers=NullHandler + +[logger_heat-translator] +level=INFO +#one can be removed based on requirements +handlers=SysLogHandler, RotatingFileHandler +qualname=heat-translator +propagate=1 + +[handler_RotatingFileHandler] +class=handlers.RotatingFileHandler +level=INFO +formatter=form01 +#rotation happens after 100MB +args=('/tmp/heat-translator.log', 'a', 100000000, 5, 'utf8') + +[handler_SysLogHandler] +class=handlers.SysLogHandler +formatter=form01 +level=INFO +args=('/dev/log', handlers.SysLogHandler.LOG_SYSLOG) + +[handler_NullHandler] +class=NullHandler +formatter=form01 +level=DEBUG +args=() + +[formatter_form01] +format = %(asctime)s - %(name)s - %(levelname)s - %(filename)s : %(message)s +datefmt = |