logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Francois Bastien" <jfbast...@cae.com>
Subject RE: Modifying logFilePath for FileAppender using a PropertyConfigurator
Date Mon, 08 Dec 2008 18:55:22 GMT
> I am trying to configure log4cxx to write its logging messages to a
log
> file. The path to the log file is not known until run-time. The way
that
> I was going to go about doing this is by creating a
> log4cxx::helpers::Properties object, setting the property and then
passing
> the Properties object to the PropertyConfigurator.
> 
> [snip]
> 
> Looking within the logstring.h file I found the LOG4CXX_STR macro
which can
> be added to line 55 to make the first error message go away (I think
because
> the macro converts my literal string to a UNICODE literal string). How
can I
> achieve the same effect for the data within the logFilePath variable
(whose
> value is only known at run-time)?

I do the following:
  const ::log4cxx::LogString wFileName(boost::lexical_cast<
::log4cxx::LogString>(wNonUnicodeString.c_str()));
  // ...
  ::log4cxx::AppenderPtr wAppender(new ::log4cxx::FileAppender(wLayout,
wFileName, wAppendToFile));
 
 
JF

Mime
View raw message