title: How to set log4cxx properties without property file?
body: <p>I am using log4cxx with normal way, which provides a property file for log4cxx. Here we can find a reference:</p>
  
  <p><a href="https://stackoverflow.com/questions/5487233/log4cxx-configuring-appender-with-arguments">log4cxx: configuring appender with arguments</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6172932/reading-property-info-in-log4cxx">Reading Property Info in Log4cxx</a></p>
  
  <p>But if I want to set log4cxx in my C++ code without property file, what should I do? I check the log4cxx code and try to set properties by log4cxx::helpers::Properties, here is my sample code:</p>
  
  <pre><code>    log4cxx::helpers::Properties properties;
      properties.setProperty(L"log4j.rootLogger",L"DEBUG");
      properties.setProperty(L"log4j.appender",L"ca");
      properties.setProperty(L"log4j.appender",L"fa");
  
      properties.setProperty(L"log4j.appender.fa",L"org.apache.log4j.FileAppender");
      properties.setProperty(L"log4j.appender.fa.Append",L"false");
      properties.setProperty(L"log4j.appender.fa.File",L"./test.log");
      properties.setProperty(L"log4j.appender.fa.layout",L"org.apache.log4j.PatternLayout");
      properties.setProperty(L"log4j.appender.fa.layout.ConversionPattern",L"%d [%t] %-5p %.16c - %m%n");
  
      properties.setProperty(L"log4j.appender.ca",L"org.apache.log4j.ConsoleAppender");
      properties.setProperty(L"log4j.appender.ca.layout",L"log4j.appender.ca.layout");
      properties.setProperty(L"log4j.appender.ca.layout.ConversionPattern",L"%d [%t] %-5p %.16c - %m%n");
  
      log4cxx::PropertyConfigurator::configure(properties);
  </code></pre>
  
  <p>But my sample code doesn't work. Why? Anyone knows how to initialize log4cxx logger without property file?</p>
  
  <p>Thanks</p>
  
  <p>Water Lin</p>