Translated log files

Registered by Luis A. Garcia

The purpose of this enhancement is to enable OpenStack to generate secondary log files in a specified locale, different from the system's locale, in order to facilitate serviceability in a scenario where a customer runs OS in a language that support personnel may not understand, for example, Chinese customer and US dev/support team.

Blueprint information

Mark McLoughlin
Luis A. Garcia
Luis A. Garcia
Series goal:
Accepted for icehouse
Milestone target:
milestone icon 2014.1
Started by
Luis A. Garcia
Completed by
Luis A. Garcia

Related branches



Using the same strategy used for translated API responses described here in other words, using oslo's gettextutils.Message object we can translate strings that we are logging in order to create a separate log in a different locale than the default log.

The idea is to create a logging Handler, e.g. the TranslationHandler, which would work very similarly to how MemoryHandler works in that it would be a helper handler with a target handler.

MemoryHandler has a target handler (which can be any stream handler such as a FileHandler) and it buffers log messages before eventually flushing to the target handler. In the case of the TranslationHandler instead of "buffering" it would "translate" log Messages, before sending the output straight to its target handler.

Using this approach we would have a generic TranslationHandler that could be used as follows in a logging.conf file to create a secondary debug level log file in Chinese, while the default could be info level in English:

    keys = production, secondary-logfile, translator


    class = handlers.WatchedFileHandler
    args = ('/var/log/nova-dev.log',)
    formatter = context

    class = nova.openstack.common.log.TranslationHandler
    target = secondary-logfile
    args = ('zh_CN',)


Current patches:,n,z

Addressed by:
    New translated log handler

Addressed by:
    Enable setting up translation handler via CONF

Addressed by:
    Add support for zh locales missing from babel


Work Items

Work items:
- Enable secondary log via additional log handler: DONE
- Enable secondary log via quick config property (e.g. similar to log-file): TODO

This blueprint contains Public information 
Everyone can see this information.