Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
course-discovery
Commits
09ebb0f3
Commit
09ebb0f3
authored
Jun 02, 2016
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated logging configuration (#117)
ECOM-4540
parent
57af64c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
35 deletions
+32
-35
course_discovery/settings/base.py
+27
-12
course_discovery/settings/devstack.py
+4
-1
course_discovery/settings/production.py
+1
-22
No files found.
course_discovery/settings/base.py
View file @
09ebb0f3
import
os
import
platform
from
logging.handlers
import
SysLogHandler
from
os.path
import
join
,
abspath
,
dirname
from
sys
import
path
# PATH vars
from
urllib.parse
import
urljoin
here
=
lambda
*
x
:
join
(
abspath
(
dirname
(
__file__
)),
*
x
)
PROJECT_ROOT
=
here
(
".."
)
...
...
@@ -199,56 +199,71 @@ PLATFORM_NAME = 'Your Platform Name Here'
# END OPENEDX-SPECIFIC CONFIGURATION
# Set up logging for development use (logging to stdout)
level
=
'DEBUG'
if
DEBUG
else
'INFO'
hostname
=
platform
.
node
()
.
split
(
"."
)[
0
]
syslog_address
=
'/var/run/syslog'
if
platform
.
system
()
.
lower
()
==
'darwin'
else
'/dev/log'
syslog_format
=
'[service_variant=discovery][
%(name)
s]
%(levelname)
s [{hostname}
%(process)
d] '
\
'[
%(pathname)
s:
%(lineno)
d] -
%(message)
s'
.
format
(
hostname
=
hostname
)
LOGGING
=
{
'version'
:
1
,
'disable_existing_loggers'
:
False
,
'formatters'
:
{
'standard'
:
{
'format'
:
'
%(asctime)
s
%(levelname)
s
%(process)
d '
'[
%(name)
s]
%(filename)
s:
%(lineno)
d -
%(message)
s'
,
'format'
:
'
%(asctime)
s
%(levelname)
s
%(process)
d [
%(name)
s]
%(pathname)
s:
%(lineno)
d -
%(message)
s'
,
},
'syslog_format'
:
{
'format'
:
syslog_format
},
},
'handlers'
:
{
'console'
:
{
'level'
:
'DEBUG'
,
'level'
:
level
,
'class'
:
'logging.StreamHandler'
,
'formatter'
:
'standard'
,
'stream'
:
'ext://sys.stdout'
,
},
'local'
:
{
'level'
:
level
,
'class'
:
'logging.handlers.SysLogHandler'
,
# Use a different address for Mac OS X
'address'
:
syslog_address
,
'formatter'
:
'syslog_format'
,
'facility'
:
SysLogHandler
.
LOG_LOCAL0
,
},
},
'loggers'
:
{
'django'
:
{
'handlers'
:
[
'console'
],
'handlers'
:
[
'console'
,
'local'
],
'propagate'
:
True
,
'level'
:
'INFO'
},
'requests'
:
{
'handlers'
:
[
'console'
],
'handlers'
:
[
'console'
,
'local'
],
'propagate'
:
True
,
'level'
:
'WARNING'
},
'factory'
:
{
'handlers'
:
[
'console'
],
'handlers'
:
[
'console'
,
'local'
],
'propagate'
:
True
,
'level'
:
'WARNING'
},
'elasticsearch'
:
{
'handlers'
:
[
'console'
],
'handlers'
:
[
'console'
,
'local'
],
'propagate'
:
True
,
'level'
:
'WARNING'
},
'urllib3'
:
{
'handlers'
:
[
'console'
],
'handlers'
:
[
'console'
,
'local'
],
'propagate'
:
True
,
'level'
:
'WARNING'
},
'django.request'
:
{
'handlers'
:
[
'console'
],
'handlers'
:
[
'console'
,
'local'
],
'propagate'
:
True
,
'level'
:
'WARNING'
},
''
:
{
'handlers'
:
[
'console'
],
'handlers'
:
[
'console'
,
'local'
],
'level'
:
'DEBUG'
,
'propagate'
:
False
},
...
...
course_discovery/settings/devstack.py
View file @
09ebb0f3
...
...
@@ -2,7 +2,10 @@ from course_discovery.settings.production import *
DEBUG
=
True
del
LOGGING
[
'handlers'
][
'local'
]
# Docker does not support the syslog socket at /dev/log. Rely on the console.
LOGGING
[
'handlers'
][
'local'
]
=
{
'class'
:
'logging.NullHandler'
,
}
# TOOLBAR CONFIGURATION
# See: http://django-debug-toolbar.readthedocs.org/en/latest/installation.html
...
...
course_discovery/settings/production.py
View file @
09ebb0f3
import
platform
import
sys
import
warnings
from
logging.handlers
import
SysLogHandler
from
os
import
environ
import
certifi
...
...
@@ -16,25 +13,7 @@ TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS
=
[
'*'
]
LOGGING
[
'handlers'
][
'local'
]
=
{
'level'
:
'INFO'
,
'class'
:
'logging.handlers.SysLogHandler'
,
# Use a different address for Mac OS X
'address'
:
'/var/run/syslog'
if
sys
.
platform
==
"darwin"
else
'/dev/log'
,
'formatter'
:
'syslog_format'
,
'facility'
:
SysLogHandler
.
LOG_LOCAL0
,
}
LOGGING
[
'formatters'
][
'syslog_format'
]
=
{
format
:
(
"[service_variant=course_discovery]"
"[
%(name)
s][env:no_env]
%(levelname)
s "
"[{hostname}
%(process)
d] [
%(filename)
s:
%(lineno)
d] "
"-
%(message)
s"
)
.
format
(
hostname
=
platform
.
node
()
.
split
(
"."
)[
0
]
)
}
LOGGING
[
'handlers'
][
'local'
][
'level'
]
=
'INFO'
# Keep track of the names of settings that represent dicts. Instead of overriding the values in base.py,
# the values read from disk should UPDATE the pre-configured dicts.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment