You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.6 KiB

  1. #include <iostream>
  2. #include <string>
  3. #include "log4cplus/hierarchy.h"
  4. #include "log4cplus/helpers/loglog.h"
  5. using namespace std;
  6. using namespace log4cplus;
  7. using namespace log4cplus::helpers;
  8. int
  9. main()
  10. {
  11. {
  12. Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("test"));
  13. log4cplus::tcout << "Logger name: " << logger.getName()
  14. << " Parent = " << logger.getParent().getName() << endl;
  15. logger = Logger::getInstance(LOG4CPLUS_TEXT("test2"));
  16. log4cplus::tcout << "Logger name: " << logger.getName()
  17. << " Parent = " << logger.getParent().getName() << endl;
  18. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest.a.b.c"));
  19. log4cplus::tcout << "Logger name: " << logger.getName()
  20. << " Parent = " << logger.getParent().getName() << endl;
  21. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest.a"));
  22. log4cplus::tcout << "Logger name: " << logger.getName()
  23. << " Parent = " << logger.getParent().getName() << endl;
  24. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest"));
  25. log4cplus::tcout << "Logger name: " << logger.getName()
  26. << " Parent = " << logger.getParent().getName() << endl;
  27. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest.a"));
  28. log4cplus::tcout << "Logger name: " << logger.getName()
  29. << " Parent = " << logger.getParent().getName() << endl;
  30. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest.a.b.c"));
  31. log4cplus::tcout << "Logger name: " << logger.getName()
  32. << " Parent = " << logger.getParent().getName() << endl;
  33. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest.a.b.c.d"));
  34. log4cplus::tcout << "Logger name: " << logger.getName()
  35. << " Parent = " << logger.getParent().getName() << endl;
  36. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest.a.b.c"));
  37. log4cplus::tcout << "Logger name: " << logger.getName()
  38. << " Parent = " << logger.getParent().getName() << endl;
  39. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest.a"));
  40. log4cplus::tcout << "Logger name: " << logger.getName()
  41. << " Parent = " << logger.getParent().getName() << endl;
  42. logger = Logger::getInstance(LOG4CPLUS_TEXT("test.subtest"));
  43. log4cplus::tcout << "Logger name: " << logger.getName()
  44. << " Parent = " << logger.getParent().getName() << endl;
  45. Logger::shutdown();
  46. }
  47. log4cplus::tcout << "Exiting main()..." << endl;
  48. return 0;
  49. }