Statistics
| Branch: | Tag: | Revision:

root / snf-webproject / synnefo / webproject / settings / default / logging.py @ 0fa71fcc

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 ddfb6278 Christos Stavrakakis
    'simple': {
9 ddfb6278 Christos Stavrakakis
        'format': '%(asctime)s [%(levelname)s] %(message)s'
10 ddfb6278 Christos Stavrakakis
    },
11 ddfb6278 Christos Stavrakakis
    'verbose': {
12 ddfb6278 Christos Stavrakakis
        'format': '%(asctime)s [%(process)d] %(name)s %(module)s [%(levelname)s] %(message)s'
13 ddfb6278 Christos Stavrakakis
    },
14 ddfb6278 Christos Stavrakakis
    'django': {
15 ddfb6278 Christos Stavrakakis
        'format': '[%(asctime)s] %(levelname)s %(message)s',
16 ddfb6278 Christos Stavrakakis
        'datefmt': '%d/%b/%Y %H:%M:%S'
17 ddfb6278 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 ddfb6278 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 ddfb6278 Christos Stavrakakis
        'mail_admins': {
43 ddfb6278 Christos Stavrakakis
            'level': 'ERROR',
44 ddfb6278 Christos Stavrakakis
            'class': 'django.utils.log.AdminEmailHandler',
45 ddfb6278 Christos Stavrakakis
            'include_html': False,
46 ddfb6278 Christos Stavrakakis
        }
47 d60dc9d4 Kostas Papadimitriou
    },
48 bdff90d3 Christos Stavrakakis
49 d60dc9d4 Kostas Papadimitriou
    'loggers': {
50 bdff90d3 Christos Stavrakakis
        '': {
51 8e176bdf Kostas Papadimitriou
            'handlers': ['console'],
52 d60dc9d4 Kostas Papadimitriou
            'level': 'INFO'
53 d60dc9d4 Kostas Papadimitriou
        },
54 ddfb6278 Christos Stavrakakis
        'django.request': {
55 ddfb6278 Christos Stavrakakis
            'handlers': ['mail_admins'],
56 ddfb6278 Christos Stavrakakis
            'level': 'ERROR',
57 901b106f Christos Stavrakakis
            'propagate': True,
58 ddfb6278 Christos Stavrakakis
        },
59 bdff90d3 Christos Stavrakakis
        'synnefo': {
60 bdff90d3 Christos Stavrakakis
            'handlers': ['console'],
61 bdff90d3 Christos Stavrakakis
            'level': 'INFO',
62 bdff90d3 Christos Stavrakakis
            'propagate': 0
63 bdff90d3 Christos Stavrakakis
        },
64 d60dc9d4 Kostas Papadimitriou
    }
65 d60dc9d4 Kostas Papadimitriou
}
66 d60dc9d4 Kostas Papadimitriou
67 ddfb6278 Christos Stavrakakis
#LOGGING_SETUP['loggers']['synnefo.admin'] = {'level': 'INFO', 'propagate': 1}
68 ddfb6278 Christos Stavrakakis
#LOGGING_SETUP['loggers']['synnefo.api'] = {'level': 'INFO', 'propagate': 1}
69 ddfb6278 Christos Stavrakakis
#LOGGING_SETUP['loggers']['synnefo.db'] = {'level': 'INFO', 'propagate': 1}
70 ddfb6278 Christos Stavrakakis
#LOGGING_SETUP['loggers']['synnefo.logic'] = {'level': 'INFO', 'propagate': 1}
71 6a8d05b4 Christos Stavrakakis
72 6a8d05b4 Christos Stavrakakis
# To set logging level for plankton to DEBUG just uncomment the follow line:
73 6a8d05b4 Christos Stavrakakis
# LOGGING_SETUP['loggers']['synnefo.plankton'] = {'level': 'INFO', 'propagate': 1}
74 6a8d05b4 Christos Stavrakakis
75 bdff90d3 Christos Stavrakakis
SNF_MANAGE_LOGGING_SETUP = {
76 bdff90d3 Christos Stavrakakis
    'version': 1,
77 662413bb Christos Stavrakakis
    'disable_existing_loggers': False,
78 bdff90d3 Christos Stavrakakis
79 bdff90d3 Christos Stavrakakis
    'formatters': FORMATTERS,
80 bdff90d3 Christos Stavrakakis
81 bdff90d3 Christos Stavrakakis
    'handlers': {
82 bdff90d3 Christos Stavrakakis
        'console': {
83 bdff90d3 Christos Stavrakakis
            'class': 'logging.StreamHandler',
84 bdff90d3 Christos Stavrakakis
            'formatter': 'verbose'
85 bdff90d3 Christos Stavrakakis
        },
86 bdff90d3 Christos Stavrakakis
    },
87 bdff90d3 Christos Stavrakakis
88 bdff90d3 Christos Stavrakakis
    'loggers': {
89 bdff90d3 Christos Stavrakakis
        '': {
90 ddfb6278 Christos Stavrakakis
            'handlers': ['console'],
91 ddfb6278 Christos Stavrakakis
            'level': 'WARNING'
92 ddfb6278 Christos Stavrakakis
        },
93 bdff90d3 Christos Stavrakakis
    }
94 bdff90d3 Christos Stavrakakis
}