List Info

Thread: Logging




Logging
user name
2006-04-11 09:36:46
Hello,

> I'm using TurboGears with CherryPy and am looking for
a way to
> consolidate all my logs. TG (and my app) log with the
logging module of
> Python and CP logs with its own method to log to file.
I would like to
> make CP log with the logging module as well since it
enables me to send
> all exceptions by email and use the rotating log files.
I found no
> documentation on how to change all logs of CP, maybe
someone here can
> shed some light on this?

You can easily customize the logging in CP by defining your
own 
_cp_log_message and _cp_log_access methods, like this:

# import cherrypy
#
# class Root:
#     def _cp_log_message(self, msg, context = '',
severity = 0):
#         print "msg:", msg
#         print "context:", context
#         print "severity:", severity
#     def _cp_log_access(self):
#         print "Access to:",
cherrypy.request.path
#     def index(self):
#         return "Hello, world"
#     index.exposed = True
#
# cherrypy.root = Root()
# cherrypy.server.start()


Remi.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )