If you are passing a string literal (for example, if you have your file name hard-coded in the source and it only contains US-ASCII character, then use something like:

fileAppender->setFile(LOG4CXX_STR("temp.log"));

or

LogString fileName(LOG4CXX_STR("temp.log"));
fileAppender->setFile(fileName);

If you have an std::string where the character values are in the current default encoding, do

std::string str;
...

fileAppender->setFile(log4cxx::helpers::Transcoder::decode(str));

If the string is in some arbitrary encoding, then use a CharsetDecoder.


On May 2, 2007, at 8:27 PM, jorrit de vries wrote:

Hello,

In my application I use std::string. To create a FileAppender I need to pass a LogString for the filename. How can I convert from std::string to LogString?

Cheers!
Jorrit



Reply via email to