import luigi
import logging
import util

def setup_logging():
    util.ensuredir('log')
    log_path = 'log/sciluigi_run_%s.log' % util.timepath()

    # Formatter
    stream_formatter = logging.Formatter('[%(asctime)s] %(message)s','%H:%M:%S')
    luigi_log_formatter = logging.Formatter('%(asctime)s %(levelname)8s    LUIGI %(message)s','%Y-%m-%d %H:%M:%S')
    sciluigi_log_formatter = logging.Formatter('%(asctime)s %(levelname)8s SCILUIGI %(message)s','%Y-%m-%d %H:%M:%S')

    # Stream handler (for STDERR)
    stream_handler = logging.StreamHandler()
    stream_handler.setFormatter(stream_formatter)
    stream_handler.setLevel(logging.INFO)

    # File handler
    luigi_file_handler = logging.FileHandler(log_path)
    luigi_file_handler.setFormatter(luigi_log_formatter)
    luigi_file_handler.setLevel(logging.DEBUG)

    sciluigi_file_handler = logging.FileHandler(log_path)
    sciluigi_file_handler.setFormatter(sciluigi_log_formatter)
    sciluigi_file_handler.setLevel(logging.DEBUG)

    # Loggers
    luigi_logger = logging.getLogger('luigi-interface')
    luigi_logger.addHandler(luigi_file_handler)
    luigi_logger.setLevel(logging.DEBUG)
    luigi.interface.setup_interface_logging.has_run = True

    sciluigi_logger = logging.getLogger('sciluigi-interface')
    sciluigi_logger.addHandler(stream_handler)
    sciluigi_logger.addHandler(sciluigi_file_handler)
    sciluigi_logger.setLevel(logging.DEBUG)

setup_logging()

def run(*args, **kwargs):
    log = logging.getLogger('sciluigi-interface')
    luigi.run(*args, **kwargs)

def run_local():
    run(local_scheduler=True)

import luigi
import logging
import util

def setup_logging():
    util.ensuredir('log')
    log_path = 'log/sciluigi_run_%s.log' % util.timepath()

    # Formatter
    stream_formatter = logging.Formatter('%(asctime)s | %(levelname)8s | %(message)s','%Y-%m-%d %H:%M:%S')
    luigi_log_formatter = logging.Formatter('%(asctime)s %(levelname)8s    LUIGI %(message)s','%Y-%m-%d %H:%M:%S')
    sciluigi_log_formatter = logging.Formatter('%(asctime)s %(levelname)8s SCILUIGI %(message)s','%Y-%m-%d %H:%M:%S')

    # Stream handler (for STDERR)
    stream_handler = logging.StreamHandler()
    stream_handler.setFormatter(stream_formatter)
    stream_handler.setLevel(logging.INFO)

    # File handler
    luigi_file_handler = logging.FileHandler(log_path)
    luigi_file_handler.setFormatter(luigi_log_formatter)
    luigi_file_handler.setLevel(logging.DEBUG)

    sciluigi_file_handler = logging.FileHandler(log_path)
    sciluigi_file_handler.setFormatter(sciluigi_log_formatter)
    sciluigi_file_handler.setLevel(logging.DEBUG)

    # Loggers
    luigi_logger = logging.getLogger('luigi-interface')
    luigi_logger.addHandler(luigi_file_handler)
    luigi_logger.setLevel(logging.DEBUG)
    luigi.interface.setup_interface_logging.has_run = True

    sciluigi_logger = logging.getLogger('sciluigi-interface')
    sciluigi_logger.addHandler(stream_handler)
    sciluigi_logger.addHandler(sciluigi_file_handler)
    sciluigi_logger.setLevel(logging.DEBUG)

setup_logging()

def run(*args, **kwargs):
    log = logging.getLogger('sciluigi-interface')
    luigi.run(*args, **kwargs)

def run_local():
    run(local_scheduler=True)

Include full date and levelnames in stdout log