Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
bc69ed8c
Commit
bc69ed8c
authored
Oct 02, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move logsettings to common, so that it's shared between cms and lms
parent
20f84b20
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
9 additions
and
105 deletions
+9
-105
cms/envs/aws.py
+1
-1
cms/envs/dev.py
+1
-1
cms/envs/logsettings.py
+0
-96
common/lib/logsettings.py
+0
-0
lms/envs/aws.py
+1
-1
lms/envs/dev.py
+1
-1
lms/envs/dev_edx4edx.py
+1
-1
lms/envs/dev_ike.py
+1
-1
lms/envs/static.py
+1
-1
lms/envs/test.py
+1
-1
lms/envs/test_ike.py
+1
-1
No files found.
cms/envs/aws.py
View file @
bc69ed8c
...
...
@@ -3,7 +3,7 @@ This is the default template for our main set of AWS servers.
"""
import
json
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
from
.common
import
*
############################### ALWAYS THE SAME ################################
...
...
cms/envs/dev.py
View file @
bc69ed8c
...
...
@@ -2,7 +2,7 @@
This config file runs the simplest dev environment"""
from
.common
import
*
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
import
logging
import
sys
...
...
cms/envs/logsettings.py
deleted
100644 → 0
View file @
20f84b20
import
os
import
os.path
import
platform
import
sys
def
get_logger_config
(
log_dir
,
logging_env
=
"no_env"
,
tracking_filename
=
None
,
syslog_addr
=
None
,
debug
=
False
):
"""Return the appropriate logging config dictionary. You should assign the
result of this to the LOGGING var in your settings. The reason it's done
this way instead of registering directly is because I didn't want to worry
about resetting the logging state if this is called multiple times when
settings are extended."""
# If we're given an explicit place to put tracking logs, we do that (say for
# debugging). However, logging is not safe for multiple processes hitting
# the same file. So if it's left blank, we dynamically create the filename
# based on the PID of this worker process.
if
tracking_filename
:
tracking_file_loc
=
os
.
path
.
join
(
log_dir
,
tracking_filename
)
else
:
pid
=
os
.
getpid
()
# So we can log which process is creating the log
tracking_file_loc
=
os
.
path
.
join
(
log_dir
,
"tracking_{0}.log"
.
format
(
pid
))
hostname
=
platform
.
node
()
.
split
(
"."
)[
0
]
syslog_format
=
(
"[
%(name)
s][env:{logging_env}]
%(levelname)
s [{hostname} "
+
"
%(process)
d] [
%(filename)
s:
%(lineno)
d] -
%(message)
s"
)
.
format
(
logging_env
=
logging_env
,
hostname
=
hostname
)
handlers
=
[
'console'
]
if
debug
else
[
'console'
,
'syslogger'
,
'newrelic'
]
return
{
'version'
:
1
,
'disable_existing_loggers'
:
False
,
'formatters'
:
{
'standard'
:
{
'format'
:
'
%(asctime)
s
%(levelname)
s
%(process)
d [
%(name)
s]
%(filename)
s:
%(lineno)
d -
%(message)
s'
,
},
'syslog_format'
:
{
'format'
:
syslog_format
},
'raw'
:
{
'format'
:
'
%(message)
s'
},
},
'handlers'
:
{
'console'
:
{
'level'
:
'DEBUG'
if
debug
else
'INFO'
,
'class'
:
'logging.StreamHandler'
,
'formatter'
:
'standard'
,
'stream'
:
sys
.
stdout
,
},
'syslogger'
:
{
'level'
:
'INFO'
,
'class'
:
'logging.handlers.SysLogHandler'
,
'address'
:
syslog_addr
,
'formatter'
:
'syslog_format'
,
},
'tracking'
:
{
'level'
:
'DEBUG'
,
'class'
:
'logging.handlers.WatchedFileHandler'
,
'filename'
:
tracking_file_loc
,
'formatter'
:
'raw'
,
},
'newrelic'
:
{
'level'
:
'ERROR'
,
'class'
:
'newrelic_logging.NewRelicHandler'
,
'formatter'
:
'raw'
,
}
},
'loggers'
:
{
'django'
:
{
'handlers'
:
handlers
,
'propagate'
:
True
,
'level'
:
'INFO'
},
'tracking'
:
{
'handlers'
:
[
'tracking'
],
'level'
:
'DEBUG'
,
'propagate'
:
False
,
},
''
:
{
'handlers'
:
handlers
,
'level'
:
'DEBUG'
,
'propagate'
:
False
},
'mitx'
:
{
'handlers'
:
handlers
,
'level'
:
'DEBUG'
,
'propagate'
:
False
},
'keyedcache'
:
{
'handlers'
:
handlers
,
'level'
:
'DEBUG'
,
'propagate'
:
False
},
}
}
lms/envs
/logsettings.py
→
common/lib
/logsettings.py
View file @
bc69ed8c
File moved
lms/envs/aws.py
View file @
bc69ed8c
...
...
@@ -8,7 +8,7 @@ Common traits:
"""
import
json
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
from
.common
import
*
############################### ALWAYS THE SAME ################################
...
...
lms/envs/dev.py
View file @
bc69ed8c
...
...
@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files
"""
from
.common
import
*
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
DEBUG
=
True
TEMPLATE_DEBUG
=
True
...
...
lms/envs/dev_edx4edx.py
View file @
bc69ed8c
...
...
@@ -14,7 +14,7 @@ if 'eecs1' in socket.gethostname():
MITX_ROOT_URL
=
'/mitx2'
from
.common
import
*
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
from
.dev
import
*
if
'eecs1'
in
socket
.
gethostname
():
...
...
lms/envs/dev_ike.py
View file @
bc69ed8c
...
...
@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files
"""
from
.common
import
*
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
from
.dev
import
*
import
socket
...
...
lms/envs/static.py
View file @
bc69ed8c
...
...
@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files
"""
from
.common
import
*
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
STATIC_GRAB
=
True
...
...
lms/envs/test.py
View file @
bc69ed8c
...
...
@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files
"""
from
.common
import
*
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
import
os
from
path
import
path
...
...
lms/envs/test_ike.py
View file @
bc69ed8c
...
...
@@ -8,7 +8,7 @@ sessions. Assumes structure:
/log # Where we're going to write log files
"""
from
.common
import
*
from
.
logsettings
import
get_logger_config
from
logsettings
import
get_logger_config
import
os
DEBUG
=
True
...
...
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