Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
5845a0b9
Commit
5845a0b9
authored
Oct 05, 1999
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed tabs to spaces and added a flush to log writing.
parent
0dc69b1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
82 deletions
+80
-82
ZServer/DebugLogger.py
ZServer/DebugLogger.py
+40
-41
lib/python/ZServer/DebugLogger.py
lib/python/ZServer/DebugLogger.py
+40
-41
No files found.
ZServer/DebugLogger.py
View file @
5845a0b9
...
...
@@ -86,48 +86,47 @@
import
time
,
thread
class
DebugLogger
:
"""
Logs debugging information about how ZServer is handling requests
and responses. This log can be used to help locate troublesome requests.
The format is:
<code> <request id> <time> <data>
where:
'code' is B for begin, I for received input, A for received output,
E for sent output.
'request id' is a unique request id.
'time' is the time in GMT ISO format.
'data' is the HTTP method and the PATH INFO for B, the size of the input
for I, the HTTP status code and the size of the output for A, or
nothing for E.
Note: This facility will be probably be adapted to the zLOG framework.
"""
def
__init__
(
self
,
filename
):
self
.
file
=
open
(
filename
,
'a+b'
)
l
=
thread
.
allocate_lock
()
self
.
_acquire
=
l
.
acquire
self
.
_release
=
l
.
release
def
log
(
self
,
code
,
request_id
,
data
=
''
):
self
.
_acquire
()
try
:
t
=
time
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
,
time
.
gmtime
(
time
.
time
()))
self
.
file
.
write
(
'%s %s %s %s
\
n
'
%
(
code
,
request_id
,
t
,
data
)
)
finally
:
self
.
_release
()
"""
Logs debugging information about how ZServer is handling requests
and responses. This log can be used to help locate troublesome requests.
The format is:
<code> <request id> <time> <data>
where:
'code' is B for begin, I for received input, A for received output,
E for sent output.
'request id' is a unique request id.
'time' is the time in GMT ISO format.
'data' is the HTTP method and the PATH INFO for B, the size of the input
for I, the HTTP status code and the size of the output for A, or
nothing for E.
Note: This facility will be probably be adapted to the zLOG framework.
"""
def
__init__
(
self
,
filename
):
self
.
file
=
open
(
filename
,
'a+b'
)
l
=
thread
.
allocate_lock
()
self
.
_acquire
=
l
.
acquire
self
.
_release
=
l
.
release
def
log
(
self
,
code
,
request_id
,
data
=
''
):
self
.
_acquire
()
try
:
t
=
time
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
,
time
.
gmtime
(
time
.
time
()))
self
.
file
.
write
(
'%s %s %s %s
\
n
'
%
(
code
,
request_id
,
t
,
data
)
)
self
.
file
.
flush
()
finally
:
self
.
_release
()
def
log
(
*
args
):
pass
\ No newline at end of file
lib/python/ZServer/DebugLogger.py
View file @
5845a0b9
...
...
@@ -86,48 +86,47 @@
import
time
,
thread
class
DebugLogger
:
"""
Logs debugging information about how ZServer is handling requests
and responses. This log can be used to help locate troublesome requests.
The format is:
<code> <request id> <time> <data>
where:
'code' is B for begin, I for received input, A for received output,
E for sent output.
'request id' is a unique request id.
'time' is the time in GMT ISO format.
'data' is the HTTP method and the PATH INFO for B, the size of the input
for I, the HTTP status code and the size of the output for A, or
nothing for E.
Note: This facility will be probably be adapted to the zLOG framework.
"""
def
__init__
(
self
,
filename
):
self
.
file
=
open
(
filename
,
'a+b'
)
l
=
thread
.
allocate_lock
()
self
.
_acquire
=
l
.
acquire
self
.
_release
=
l
.
release
def
log
(
self
,
code
,
request_id
,
data
=
''
):
self
.
_acquire
()
try
:
t
=
time
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
,
time
.
gmtime
(
time
.
time
()))
self
.
file
.
write
(
'%s %s %s %s
\
n
'
%
(
code
,
request_id
,
t
,
data
)
)
finally
:
self
.
_release
()
"""
Logs debugging information about how ZServer is handling requests
and responses. This log can be used to help locate troublesome requests.
The format is:
<code> <request id> <time> <data>
where:
'code' is B for begin, I for received input, A for received output,
E for sent output.
'request id' is a unique request id.
'time' is the time in GMT ISO format.
'data' is the HTTP method and the PATH INFO for B, the size of the input
for I, the HTTP status code and the size of the output for A, or
nothing for E.
Note: This facility will be probably be adapted to the zLOG framework.
"""
def
__init__
(
self
,
filename
):
self
.
file
=
open
(
filename
,
'a+b'
)
l
=
thread
.
allocate_lock
()
self
.
_acquire
=
l
.
acquire
self
.
_release
=
l
.
release
def
log
(
self
,
code
,
request_id
,
data
=
''
):
self
.
_acquire
()
try
:
t
=
time
.
strftime
(
'%Y-%m-%dT%H:%M:%S'
,
time
.
gmtime
(
time
.
time
()))
self
.
file
.
write
(
'%s %s %s %s
\
n
'
%
(
code
,
request_id
,
t
,
data
)
)
self
.
file
.
flush
()
finally
:
self
.
_release
()
def
log
(
*
args
):
pass
\ No newline at end of file
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