(ロギング)

Python logging package is used to log from Plone.

By default, logs go to var/log/instance.log. If Zope instance is started in the foreground mode logs will be printed in the console (stdout) too.

Default log level is INFO. To enable more verbose logging, edit buildout.cfg, change log level by editing [instance] section event-log-level.

Logging from Python code

Example:

import logging

logger = logging.getLogger("Plone")

class MySomething(object):
    ...
    def function(self):
        logger.info("Reached function()")
        ...

Logging from page templates and RestrictedPython scripts

Python logging module doesn’t provide Zope 2 security assertations. Python script plone_log exposes logging for sandboxed environments.

Example:

context.plone_log("This is so fun")

目次

前のトピックへ

(テストとデバッグ)

次のトピックへ

(Python デバッグ (pdb))

このページ