
#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
	try{
		log4cpp::PropertyConfigurator().configure("logger.ini");
	}
	catch(const std::exception & e)
	{
		std::cerr << "Can`t configure logger" << e.what() << std::endl;
		return -1;
	}

	log4cpp::Category & log1 = log4cpp::Category::getInstance("cat1");
	log1.emergStream() << "Пробуем первый раз";
	
	log4cpp::Category & log2 = log4cpp::Category::getInstance("cat1.cat2");
	log2.emergStream() << "Пробуем второй раз";
	
	log4cpp::Category & log3 = log4cpp::Category::getInstance("cat1.cat2.cat3");
	log3.emergStream() << "Пробуем третий раз";
	
	log4cpp::NDC::push("NDC1");
		log3.emergStream() << "log4cpp::NDC::push(\"NDC1\"); ";
		log4cpp::NDC::push("NDC2");
			log2.emergStream() << "log4cpp::NDC::push(\"NDC2\"); ";
			log4cpp::NDC::push("NDC3");
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
			log1.emergStream() << "log4cpp::NDC::push(\"NDC3\"); ";
 			log4cpp::NDC::pop();
		log2.emergStream() << "log4cpp::NDC::push(\"NDC2\"); ";
		log4cpp::NDC::pop();
	log3.emergStream() << "log4cpp::NDC::push(\"NDC1\"); ";
	log4cpp::NDC::pop();
	
	

	return 0;
}

