// LogTest.cpp : Defines the entry point for the console application.
//

#include <log4cxx/Logger.h>
#include <log4cxx/PropertyConfigurator.h>
#include <log4cxx/LogManager.h>

void print( log4cxx::LoggerPtr& logger )
{
  log4cxx::LoggerPtr l=logger;

  for (l=logger;l;l=l->getParent())
  {
    printf("%s[%s]->",l->getName().c_str(),l->getLevel() ? l->getLevel()->toString().c_str() : "?" );
  }
  printf("\n");
}

int main(int argc, char* argv[])
{
  log4cxx::LoggerPtr Logger11 = log4cxx::Logger::getLogger( "Comm.CommClient" );
  log4cxx::LoggerPtr Logger12 = log4cxx::Logger::getLogger( "Comm.CommServer" );

  print( Logger11 );
  print( Logger12 );

  log4cxx::PropertyConfigurator::configureAndWatch( log4cxx::File( "\\dev\\LogTest.properties" ) );

  print( Logger11 );
  print( Logger12 );

  int i=0;
  while (++i<3)
  {
    Logger11->debug("test logging text");
    Logger12->debug("test logging text");
  }

  log4cxx::LogManager::shutdown();

  return 0;
}

