<commit_before>import logging
import os

import tornado.ioloop
import tornado.log
import tornado.web


def configure_tornado_logging():
    fh = logging.handlers.RotatingFileHandler(
        '/var/log/ipborg/tornado.log', maxBytes=2**29, backupCount=10)

    fmt = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
    fh.setFormatter(fmt)

    logger = logging.getLogger('tornado')
    logger.setLevel(logging.DEBUG)
    logger.addHandler(fh)

    tornado.log.enable_pretty_logging(logger=logger)
configure_tornado_logging()


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('{}'.format(os.environ.get('MC_PORT')))

application = tornado.web.Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":<commit_msg>Add Tornado settings and log location command line options.<commit_after>import logging
import os

import tornado.ioloop
import tornado.log
import tornado.options
import tornado.web


tornado.options.define('tornado_log_file',
                       default='/var/log/ipborg/torando.log',
                       type=str)
tornado.options.define('app_log_file',
                       default='/var/log/ipborg/app.log',
                       type=str)
tornado.options.parse_command_line()


def configure_tornado_logging():
    fh = logging.handlers.RotatingFileHandler(
        tornado.options.options.tornado_log_file,
        maxBytes=2**29, backupCount=10)

    fmt = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
    fh.setFormatter(fmt)

    logger = logging.getLogger('tornado')
    logger.setLevel(logging.DEBUG)
    logger.addHandler(fh)

    tornado.log.enable_pretty_logging(logger=logger)
configure_tornado_logging()


settings = {
    'static_path': os.path.join(os.path.dirname(__file__), 'static'),
    'template_path': os.path.join(os.path.dirname(__file__), 'templates'),
    'debug': True,
    'gzip': True
}


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('{}'.format(os.environ.get('MC_PORT')))


application = tornado.web.Application([
    (r"/", MainHandler),
], **settings)


if __name__ == "__main__":
{'fraction_non_alphanumeric': 0.1418013856812933, 'fraction_numerical': 0.004618937644341801, 'mean_word_length': 3.889390519187359, 'pattern_counts': {'":': 2, '<': 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': '7256491', 'n_tokens_mistral': 743, 'n_tokens_neox': 707, 'n_words': 104}