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
b8477cc7
Commit
b8477cc7
authored
Nov 27, 2015
by
Syed Hasan raza
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9700 from edx/shr/bug/AN-4509-Unicode-Decode-Error
LoggerBackend encoding for json dumps
parents
3198c040
0f67d19a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
common/djangoapps/track/backends/logger.py
+8
-1
No files found.
common/djangoapps/track/backends/logger.py
View file @
b8477cc7
...
...
@@ -11,6 +11,7 @@ from track.backends import BaseBackend
from
track.utils
import
DateTimeJSONEncoder
log
=
logging
.
getLogger
(
'track.backends.logger'
)
application_log
=
logging
.
getLogger
(
'track.backends.application_log'
)
# pylint: disable=invalid-name
class
LoggerBackend
(
BaseBackend
):
...
...
@@ -33,7 +34,13 @@ class LoggerBackend(BaseBackend):
self
.
event_logger
=
logging
.
getLogger
(
name
)
def
send
(
self
,
event
):
event_str
=
json
.
dumps
(
event
,
cls
=
DateTimeJSONEncoder
)
try
:
event_str
=
json
.
dumps
(
event
,
cls
=
DateTimeJSONEncoder
)
except
UnicodeDecodeError
:
application_log
.
exception
(
"UnicodeDecodeError Event_type:
%
r, Event_source:
%
r, Page:
%
r, Referer:
%
r"
,
event
.
get
(
'event_type'
),
event
.
get
(
'event_source'
),
event
.
get
(
'page'
),
event
.
get
(
'referer'
)
)
# TODO: remove trucation of the serialized event, either at a
# higher level during the emittion of the event, or by
...
...
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