[
https://issues.apache.org/jira/browse/LOGCXX-378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thorsten Schöning resolved LOGCXX-378.
--------------------------------------
Resolution: Duplicate
This is a duplicate of LOGCXX-370.
> Unicode characters not substituted correctly from environment variables in
> log configuration file
> -------------------------------------------------------------------------------------------------
>
> Key: LOGCXX-378
> URL: https://issues.apache.org/jira/browse/LOGCXX-378
> Project: Log4cxx
> Issue Type: Bug
> Components: Configurator
> Affects Versions: 0.10.0
> Environment: Windows 7 64 bit, log4cxx built with VS2005
> Reporter: Jason Whitwill
> Assignee: Curt Arnold
> Priority: Minor
>
> Under region and language in the control panel, everything is set to English
> (United States) The user name has Chinese characters which are interpreted
> correctly in Windows Explorer and in my Unicode MFC application.
> When using environment variables for the filename (not the path) I get a file
> output but the characters of the file name are garbled (from some other
> language).
> If I execute the following code snippet, it interprets the environment
> variable correctly and the file is output with the correct path and file name.
> wchar_t lPathPtr[2048];
> size_t lPathSize = 0;
> _wgetenv_s( &lPathSize, lPathPtr, 2048, L"APPDATA" );
> if ( lPathPtr != NULL )
> {
> wchar_t lPath[2048];
> StringCbPrintfW(lPath, 2048, L"%s\\unicode_test.txt", lPathPtr);
>
> log4cxx::LayoutPtr layout(new log4cxx::SimpleLayout());
> log4cxx::FileAppenderPtr appender(new log4cxx::FileAppender(layout,
> lPath, true));
> LoggerPtr logger(Logger::getLogger("MyApp"));
> logger->addAppender( appender );
>
> wchar_t lString[512];
> mTextBox.GetWindowTextW( lString, 512 );
> LOG4CXX_INFO(logger, lString );
> }
> However if I create a configuration file that looks like this...
> log4j.rootLogger=info, R
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=${TESTENV}
> log4j.appender.R.MaxFileSize=100KB
> log4j.appender.R.MaxBackupIndex=1
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%r %p %t %c - %m%n
> ...and open that configuration file with a code snippet that looks like
> this...
> LoggerPtr logger(Logger::getLogger("MyApp"));
> PropertyConfigurator::configure("test.logcfg");
> LOG4CXX_INFO(logger, "Entering application.");
> ... the file name ends up being garbled with funny characters.
> Obviously if I replace ${TESTENV} with ${APPDATA}/unicode_test.txt, I don't
> see any output because the garbled folder path doesn't exist. This seems to
> be the case for European characters outside of the ascii range as well (like
> the german umlaut or the accent aigu in French).
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)