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
850f8a36
Commit
850f8a36
authored
Nov 24, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up logging to have sensible defaults for production.
parent
6a43b910
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
course_discovery/settings/production.py
+22
-1
course_discovery/settings/utils.py
+1
-1
No files found.
course_discovery/settings/production.py
View file @
850f8a36
from
os
import
environ
import
platform
import
sys
import
yaml
from
logging.handlers
import
SysLogHandler
from
course_discovery.settings.base
import
*
from
course_discovery.settings.utils
import
get_env_setting
...
...
@@ -10,7 +13,25 @@ TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS
=
[
'*'
]
LOGGING
=
environ
.
get
(
'LOGGING'
,
LOGGING
)
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
]
)
}
CONFIG_FILE
=
get_env_setting
(
'COURSE_DISCOVERY_CFG'
)
with
open
(
CONFIG_FILE
)
as
f
:
...
...
course_discovery/settings/utils.py
View file @
850f8a36
...
...
@@ -10,6 +10,6 @@ def get_env_setting(setting):
try
:
return
environ
[
setting
]
except
KeyError
:
error_msg
=
"Set the [
%
s] env variable!"
%
setting
error_msg
=
"Set the [
{}] env variable!"
.
format
(
setting
)
raise
ImproperlyConfigured
(
error_msg
)
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