<commit_before>import logging
import logging.handlers
import os
import signal
import sys
import traceback

ENABLE_DEV_LOGGING_FILE = ("/opt/xensource/packages/files/xscontainer/"
                           "devmode_enabled")


def configurelogging():
    _LOGGER.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        'xscontainer[%(process)d] - %(levelname)s - %(message)s')
    handler = logging.handlers.SysLogHandler(
        address='/dev/log', facility=logging.handlers.SysLogHandler.LOG_DAEMON)
    handler.setFormatter(formatter)
    _LOGGER.addHandler(handler)
    if os.path.exists(ENABLE_DEV_LOGGING_FILE):
        # log to stdout
        streamhandler = logging.StreamHandler(sys.stderr)
        streamhandler.setLevel(logging.DEBUG)
        streamhandler.setFormatter(formatter)
        _LOGGER.addHandler(streamhandler)
        # log everything
        streamhandler.setLevel(logging.DEBUG)
        handler.setLevel(logging.DEBUG)
    else:
        # log info and above
        handler.setLevel(logging.INFO)
    signal.signal(signal.SIGPIPE, signal.SIG_DFL)


def debug(message):
    _LOGGER.debug(message)


def info(message):
    _LOGGER.info(message)<commit_msg>CP-11222: moving the logging output to it's own log file 'xscontainer.log'.<commit_after>import logging
import logging.handlers
import os
import signal
import sys
import traceback

ENABLE_DEV_LOGGING_FILE = ("/opt/xensource/packages/files/xscontainer/"
                           "devmode_enabled")

LOG_FILE = "/var/log/xscontainer.log"


def configurelogging():
    _LOGGER.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        'xscontainer[%(process)d] - %(levelname)s - %(message)s')
    fileh = logging.FileHandler(LOG_FILE)
    fileh.setFormatter(formatter)
    _LOGGER.addHandler(fileh)
    if os.path.exists(ENABLE_DEV_LOGGING_FILE):
        # log to stdout
        streamhandler = logging.StreamHandler(sys.stderr)
        streamhandler.setLevel(logging.DEBUG)
        streamhandler.setFormatter(formatter)
        _LOGGER.addHandler(streamhandler)
        # log everything
        streamhandler.setLevel(logging.DEBUG)
        fileh.setLevel(logging.DEBUG)
    else:
        # log info and above
        fileh.setLevel(logging.INFO)
    signal.signal(signal.SIGPIPE, signal.SIG_DFL)


def debug(message):
    _LOGGER.debug(message)


def info(message):
    _LOGGER.info(message)
{'fraction_non_alphanumeric': 0.09987463435018805, 'fraction_numerical': 0.002089427496865859, 'mean_word_length': 3.305755395683453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2856472', 'n_tokens_mistral': 740, 'n_tokens_neox': 730, 'n_words': 123}