1
0
Fork 0
gnuviechadmin-historic/backend/log4py/log4py-classtest.py
Jan Dittberner dc0da570ab bringing log4py-1.3 into the main branch
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@85 a67ec6bc-e5d5-0310-a910-815c51eb3124
2004-12-26 12:53:50 +00:00

40 lines
1,000 B
Python
Executable file

#!/usr/bin/env python
"""Test class for log4py.
You should get output like this:
--------
20-10-2001 21:19 sharedlog.__init__ [DEBUG]- Shared log instantiated
20-10-2001 21:19 Main.get_instance [DEBUG]- Instantiated
20-10-2001 21:19 Main.Main [INFO]- in main
20-10-2001 21:19 c1.get_instance [DEBUG]- Instantiated
20-10-2001 21:19 c1.__init__ [INFO]- in c1
20-10-2001 21:19 c2.get_instance [DEBUG]- Instantiated
20-10-2001 21:19 c2.__init__ [INFO]- in c2
20-10-2001 21:19 c1.__init__ [INFO]- in c1
--------
Author: Bruce Kroeze <bruce@zefamily.org>
"""
from log4py import Logger, LOGLEVEL_DEBUG
class c1:
def __init__(self):
log = Logger().get_instance(self)
log.info("in c1")
class c2:
def __init__(self):
log = Logger().get_instance(self)
log.info("in c2")
if (__name__ == '__main__'):
log = Logger("$HOME/log4py.conf").get_instance()
log.get_root().set_loglevel(LOGLEVEL_DEBUG)
log.info("in main")
a = c1()
b = c2()
c = c1()