File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,59 @@ Start your app and look at /var/log/loghogd/my-first-app/ to see your applicatio
79
79
80
80
For more extensive configuration, see the examples directory.
81
81
82
+ ** Step 4: Django** : If you want to use LogHog with your Django application, add
83
+ the following code to your settings.py:
84
+
85
+ LOGHOG_APP_NAME = 'my-first-app'
86
+
87
+ LOGGING = {
88
+ 'version': 1,
89
+ 'disable_existing_loggers': True,
90
+ 'formatters': {
91
+ 'simple': {
92
+ 'format': '%(levelname)s - %(message)s'
93
+ },
94
+ },
95
+ 'handlers': {
96
+ 'root':{
97
+ 'level':'DEBUG',
98
+ 'class':'loghog.LoghogHandler',
99
+ 'app_name': LOGHOG_APP_NAME,
100
+ 'formatter': 'simple',
101
+ },
102
+ },
103
+ 'loggers': {
104
+ 'root': {
105
+ 'handlers':['root', ],
106
+ 'propagate': False,
107
+ 'level': 'INFO',
108
+ },
109
+ 'django': {
110
+ 'handlers':['root', ],
111
+ 'propagate': False,
112
+ 'level': 'INFO',
113
+ },
114
+ 'django.request': {
115
+ 'handlers': ['root', ],
116
+ 'level': 'INFO',
117
+ 'propagate': False,
118
+ },
119
+ }
120
+ }
121
+
122
+ Now, all default logging from within Django will be sent to the LogHog server.
123
+ If you want to send log messages from within your code, you can:
124
+
125
+ import logging
126
+ logger = logging.getLogger('django')
127
+
128
+ def view(request):
129
+ # ...
130
+ logger.info('Hello world')
131
+ # ...
132
+ return response
133
+
134
+
82
135
## Configuration
83
136
84
137
LogHog can do a lot of things for you. It can rotate files based on a schedule or file size,
You can’t perform that action at this time.
0 commit comments