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
1f3a5518
Commit
1f3a5518
authored
Jul 21, 1999
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding LOGGING.txt
parent
c3c0e969
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
doc/LOGGING.txt
doc/LOGGING.txt
+107
-0
No files found.
doc/LOGGING.txt
0 → 100644
View file @
1f3a5518
Zope Logging
Zope2 now comes with a Logging facility called ZLogger. ZLogger is
an extesable logging system. Currently, ZLogger will log either to a
file or to syslog (the syslog logging even works on windows because
it talks directly to the syslog server using UDP, instead of the
POSIX syslog calls).
Logging is controlled by setting environment variables. This is done
easiest by providing them on the z2.py command line. For example::
$ python1.5.2 z2.py ZSYSLOG_SERVER="syslog.mydomain.com:514" \
STUPID_FILE_LOGGER=var/Zope.log"
Currently, the following environment variables can be set:
STUPID_FILE_LOGGER="path"
The stupid file logger writes Zope logging information to a file.
It is not very smart about it (it just dumps it to a file and the
format is not very configurable), hence the name.
ZSYSLOG="anything"
Setting this environment variable will cause Zope to try and write
to the '/dev/log' UNIX domain socket. This will only work on UNIX,
and only if your syslogd domain socket is named /dev/log.
ZSYSLOG_SERVER="machine.name:port"
Setting this environment variable tells Zope to connect a UDP
socket to machine.name (which can be a name or IP address) and
'port' which must be an integer. The default syslogd port is '514'
but Zope does not pick a sane default, you must specify a port.
This may change, so check back here in future Zope releases.
Calling the logger in your code
If you want your own Zope extensions to use the logging, it can be
done so::
import zLOG
zLOG.LOG(subsystem, severity, summary, detail, error, reraise)
The following required arguments are:
subsystem -- The subsystem generating the message (e.g. ZODB)
severity -- The "severity" of the event. This may be an integer or
a floating point number. Logging back ends may
consider the int() of this valua to be significant.
For example, a backend may consider any severity
who's integer value is WARNING to be a warning. By
default, the zLOG module defines the following
severities:
BLATHER=-100
INFO=0
PROBLEM=WARNING=100
ERROR=200
PANIC=300
summary -- A short summary of the event
detail -- A detailed description
error -- A three-element tuple consisting of an error type, value, and
traceback. If provided, then a summary of the error
is added to the detail.
reraise -- If provided with a true value, then the error given by
error is reraised.
Creating your own Logger
Creating your own Zope logger is easy. Simply define an logger class
with the following interface::
class LumberJack:
""" a Logger
I sleep all night, I work all day
"""
def __init__(self):
pass
def __call__(self, sub, sev, sum, det, err):
print ' %s, %s, %s, %s, %s, %s' % (self, sub, sev, sum, det, err)
Then you must edit lib/python/Zope/ZLogger/ZLogger.py and instanciate
one of your Loggers into the 'logger' tuple::
loggers = (stupidFileLogger.stupidFileLogger(),
syslogLogger.syslogLogger(),
LumberJack.LumberJack(),)
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