#! /usr/bin/env python
#
"""
A test harness for the logging module. Tests file-based configuration.
"""
import logging, socket

try:
	logging.fileConfig("logging.cfg")
	plog = logging.getLogger("parent")
	glog = logging.getLogger("parent.child.grandchild")
	plog.error("Error")
	glog.error("Error")
	plog.warn("Warning")
	glog.warn("Warning")
	clog = logging.getLogger("parent.child")
	clog.error("Error")
	clog.warn("Warn")
	logging.shutdown()
except socket.error:
	print "A socket error occurred. Ensure that logrecv.py is running to receive logging requests from this script."
	raise

