Commit c8ee8025 authored by c.fortmanngrote's avatar c.fortmanngrote
Browse files

Module level logging and basicConfig in __init__.

parent 674a3c73
Pipeline #258964 failed with stages
in 3 minutes and 50 seconds
......@@ -21,16 +21,15 @@ app.config.from_object(Config)
app.config['UPLOAD_DIR'] = upload_dir
# Logging
logger = logging.getLogger('rarefan')
formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(module)s: %(message)s')
handler = logging.FileHandler("/tmp/rarefan.log")
handler = logging.FileHandler(filename="/tmp/rarefan.log")
handler.setFormatter(formatter)
if app.debug:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)
logger.addHandler(handler)
# Configure root logger (this config will trickle down to all module loggers.)
logging.basicConfig(handlers=[handler], filemode='a', level=logging.DEBUG)
logger = logging.getLogger(__name__)
if app.debug:
logger.debug("****************** Debug mode is active ******************")
......
......@@ -7,7 +7,7 @@ import rq
from rq.exceptions import NoSuchJobError
import logging
logger = logging.getLogger('rarefan')
logger = logging.getLogger(__name__)
from app import app, db
......
......@@ -34,7 +34,7 @@ import subprocess
import tempfile
import time
logger = logging.getLogger('rarefan')
logger = logging.getLogger(__name__)
def get_status_code(run_id_path):
# Check if the run has finished.
......
......@@ -20,7 +20,7 @@ from app.models import Job as DBJob
import jinja2
import logging
logger = logging.getLogger('rarefan')
logger = logging.getLogger(__name__)
app.app_context().push()
......
......@@ -8,7 +8,7 @@ import subprocess
from app.models import Job as DBJob
from rq import get_current_job
import logging
logger = logging.getLogger('rarefan')
logger = logging.getLogger(__name__)
from app.utilities.rarefan_cli import rarefan_command
......
......@@ -2,7 +2,7 @@
import time
import logging
logger = logging.getLogger()
logger = logging.getLogger(__name__)
def example(seconds):
seconds=int(seconds)
......
......@@ -7,7 +7,7 @@ from app.models import Job as DBJob
from rq import get_current_job
import logging
logger = logging.getLogger('rarefan')
logger = logging.getLogger(__name__)
def tree_task(run_dir, treefile=None):
""" Generate a phylogenetic tree from all DNA sequence files in given directory.
......
......@@ -7,7 +7,7 @@ import shutil
from app.models import Job as DBJob
from rq import get_current_job
import logging
logger = logging.getLogger('rarefan')
logger = logging.getLogger(__name__)
def zip_task(run_dir):
......
import sys
import os
import logging
logger = logging.getLogger('rarefan')
logger = logging.getLogger(__name__)
def count_lines(fname):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment