Statistics
| Branch: | Tag: | Revision:

root / snf-webproject / synnefo / webproject / settings / default / logging.py @ 49026a89

History | View | Annotate | Download (2.3 kB)

1 bdff90d3 Christos Stavrakakis
# -*- coding: utf-8 -*-
2 bdff90d3 Christos Stavrakakis
#
3 bdff90d3 Christos Stavrakakis
# Logging configuration
4 bdff90d3 Christos Stavrakakis
##################################
5 bdff90d3 Christos Stavrakakis
6 bdff90d3 Christos Stavrakakis
7 bdff90d3 Christos Stavrakakis
FORMATTERS = {
8 d60dc9d4 Kostas Papadimitriou
        'simple': {
9 bdff90d3 Christos Stavrakakis
            'format': '%(asctime)s [%(levelname)s] %(message)s'
10 d60dc9d4 Kostas Papadimitriou
        },
11 d60dc9d4 Kostas Papadimitriou
        'verbose': {
12 bdff90d3 Christos Stavrakakis
            'format': '%(asctime)s [%(process)d] %(name)s %(module)s [%(levelname)s] %(message)s'
13 d60dc9d4 Kostas Papadimitriou
        },
14 bdff90d3 Christos Stavrakakis
        'django': {
15 bdff90d3 Christos Stavrakakis
            'format': '[%(asctime)s] %(levelname)s %(message)s',
16 bdff90d3 Christos Stavrakakis
            'datefmt': '%d/%b/%Y %H:%M:%S'
17 bdff90d3 Christos Stavrakakis
        },
18 bdff90d3 Christos Stavrakakis
}
19 bdff90d3 Christos Stavrakakis
20 bdff90d3 Christos Stavrakakis
21 bdff90d3 Christos Stavrakakis
LOGGING_SETUP = {
22 bdff90d3 Christos Stavrakakis
    'version': 1,
23 f1e424a5 Christos Stavrakakis
    'disable_existing_loggers': False,
24 bdff90d3 Christos Stavrakakis
25 bdff90d3 Christos Stavrakakis
    'formatters':  FORMATTERS,
26 d60dc9d4 Kostas Papadimitriou
    'handlers': {
27 d60dc9d4 Kostas Papadimitriou
        'null': {
28 d60dc9d4 Kostas Papadimitriou
            'class': 'logging.NullHandler',
29 d60dc9d4 Kostas Papadimitriou
        },
30 d60dc9d4 Kostas Papadimitriou
        'console': {
31 d60dc9d4 Kostas Papadimitriou
            'class': 'logging.StreamHandler',
32 d60dc9d4 Kostas Papadimitriou
            'formatter': 'verbose'
33 d60dc9d4 Kostas Papadimitriou
        },
34 bdff90d3 Christos Stavrakakis
        'syslog': {
35 bdff90d3 Christos Stavrakakis
            'class': 'logging.handlers.SysLogHandler',
36 bdff90d3 Christos Stavrakakis
            'address': '/dev/log',
37 bdff90d3 Christos Stavrakakis
#            'address': ('localhost', 514),
38 bdff90d3 Christos Stavrakakis
            'facility': 'daemon',
39 d60dc9d4 Kostas Papadimitriou
            'formatter': 'verbose',
40 bdff90d3 Christos Stavrakakis
            'level': 'INFO',
41 d60dc9d4 Kostas Papadimitriou
        },
42 d60dc9d4 Kostas Papadimitriou
    },
43 bdff90d3 Christos Stavrakakis
44 d60dc9d4 Kostas Papadimitriou
    'loggers': {
45 bdff90d3 Christos Stavrakakis
        '': {
46 8e176bdf Kostas Papadimitriou
            'handlers': ['console'],
47 d60dc9d4 Kostas Papadimitriou
            'level': 'INFO'
48 d60dc9d4 Kostas Papadimitriou
        },
49 bdff90d3 Christos Stavrakakis
        'synnefo': {
50 bdff90d3 Christos Stavrakakis
            'handlers': ['console'],
51 bdff90d3 Christos Stavrakakis
            'level': 'INFO',
52 bdff90d3 Christos Stavrakakis
            'propagate': 0
53 bdff90d3 Christos Stavrakakis
        },
54 d60dc9d4 Kostas Papadimitriou
    }
55 d60dc9d4 Kostas Papadimitriou
}
56 d60dc9d4 Kostas Papadimitriou
57 6a8d05b4 Christos Stavrakakis
LOGGING_SETUP['loggers']['synnefo.admin'] = {'level': 'INFO', 'propagate': 1}
58 6a8d05b4 Christos Stavrakakis
LOGGING_SETUP['loggers']['synnefo.api'] = {'level': 'INFO', 'propagate': 1}
59 6a8d05b4 Christos Stavrakakis
LOGGING_SETUP['loggers']['synnefo.db'] = {'level': 'INFO', 'propagate': 1}
60 6a8d05b4 Christos Stavrakakis
LOGGING_SETUP['loggers']['synnefo.logic'] = {'level': 'INFO', 'propagate': 1}
61 6a8d05b4 Christos Stavrakakis
62 6a8d05b4 Christos Stavrakakis
# To set logging level for plankton to DEBUG just uncomment the follow line:
63 6a8d05b4 Christos Stavrakakis
# LOGGING_SETUP['loggers']['synnefo.plankton'] = {'level': 'INFO', 'propagate': 1}
64 6a8d05b4 Christos Stavrakakis
65 bdff90d3 Christos Stavrakakis
SNF_MANAGE_LOGGING_SETUP = {
66 bdff90d3 Christos Stavrakakis
    'version': 1,
67 bdff90d3 Christos Stavrakakis
    'disable_existing_loggers': True,
68 bdff90d3 Christos Stavrakakis
69 bdff90d3 Christos Stavrakakis
    'formatters': FORMATTERS,
70 bdff90d3 Christos Stavrakakis
71 bdff90d3 Christos Stavrakakis
    'handlers': {
72 bdff90d3 Christos Stavrakakis
        'console': {
73 bdff90d3 Christos Stavrakakis
            'class': 'logging.StreamHandler',
74 bdff90d3 Christos Stavrakakis
            'formatter': 'verbose'
75 bdff90d3 Christos Stavrakakis
        },
76 bdff90d3 Christos Stavrakakis
    },
77 bdff90d3 Christos Stavrakakis
78 bdff90d3 Christos Stavrakakis
    'loggers': {
79 bdff90d3 Christos Stavrakakis
        '': {
80 bdff90d3 Christos Stavrakakis
                'handlers': ['console'],
81 bdff90d3 Christos Stavrakakis
                'level': 'WARNING'
82 bdff90d3 Christos Stavrakakis
            },
83 bdff90d3 Christos Stavrakakis
    }
84 bdff90d3 Christos Stavrakakis
}
85 6a8d05b4 Christos Stavrakakis
86 6a8d05b4 Christos Stavrakakis
SNF_MANAGE_LOGGING_SETUP['loggers']['synnefo'] = {'handlers': ['console'],
87 6a8d05b4 Christos Stavrakakis
                                                  'level': 'WARNING',
88 6a8d05b4 Christos Stavrakakis
                                                  'propagate': 0}