PropertyConfigurator.hh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * SimpleConfigurator.hh
  3. *
  4. * Copyright 2001, Glen Scott. All rights reserved.
  5. *
  6. * See the COPYING file for the terms of usage and distribution.
  7. */
  8. #ifndef _LOG4CPP_PROPERTYCONFIGURATOR_HH
  9. #define _LOG4CPP_PROPERTYCONFIGURATOR_HH
  10. #include <log4cpp/Portability.hh>
  11. #include <log4cpp/Export.hh>
  12. #include <string>
  13. #include <log4cpp/Configurator.hh> // configure exceptions
  14. namespace log4cpp {
  15. /**
  16. Property configurator will read a config file using the same (or similar)
  17. format to the config file used by log4j. This file is in a standard Java
  18. "properties" file format.
  19. <P>Example:<BR>
  20. <PRE>
  21. # a simple test config
  22. log4j.rootCategory=DEBUG, rootAppender
  23. log4j.category.sub1=A1
  24. log4j.category.sub2=INFO
  25. log4j.category.sub1.sub2=ERROR, A2
  26. log4j.appender.rootAppender=org.apache.log4j.ConsoleAppender
  27. log4j.appender.rootAppender.layout=org.apache.log4j.BasicLayout
  28. log4j.appender.A1=org.apache.log4j.FileAppender
  29. log4j.appender.A1.fileName=A1.log
  30. log4j.appender.A1.layout=org.apache.log4j.BasicLayout
  31. log4j.appender.A2=org.apache.log4j.ConsoleAppender
  32. log4j.appender.A2.layout=org.apache.log4j.PatternLayout
  33. log4j.appender.A2.layout.ConversionPattern=The message %%m at time %%d%%n
  34. </PRE>
  35. @since 0.3.2
  36. **/
  37. class LOG4CPP_EXPORT PropertyConfigurator {
  38. public:
  39. /**
  40. *
  41. * @param initFileName
  42. * @exception ConfigureFailure if the method encountered a read or
  43. * syntax error.
  44. */
  45. static void configure(const std::string& initFileName);
  46. };
  47. }
  48. #endif // _LOG4CPP_PROPERTYCONFIGURATOR_HH