Re: [Log4cplus-devel] how to change log4cplu log file to utf8
Logging Framework for C++
Brought to you by:
wilx
From: Manuj G. <ma...@hc...> - 2014-06-30 04:31:55
|
When you say “try to imbue it with en_US.UTF-8” I am guessing you are talking about using log4cplus.appender.DATA.Locale= en_US.UTF-8 right? From: Václav Zeman [mailto:vha...@gm...] Sent: 29 June 2014 11:44 PM To: log...@li... Subject: Re: [Log4cplus-devel] how to change log4cplu log file to utf8 On 26.6.2014 06:54, Manuj Gupta wrote: I have been handed a code which uses log4cplus as the logger application. How can I generate a UTF8 logging file for it?. The logfile being created by log4cplus is in ASCII format at the moment. I have tried the follow Setting the file encoding of the log file by following instructions at Change File Encoding to utf-8 via vim in a script<http://stackoverflow.com/questions/2311750/change-file-encoding-to-utf-8-via-vim-in-a-script> vi dataLog.txt :set bomb :set fileencoding=utf-8 :wq I have also tried changing the .properties file log4cplus.logger.dl=TRACE,DATA log4cplus.appender.DATA=log4cplus::RollingFileAppender log4cplus.appender.DATA.Locale=en-US log4cplus.appender.DATA.File=/usr/vm/log/data/dataLog.txt log4cplus.appender.DATA.MaxFileSize=5000KB log4cplus.appender.DATA.MaxBackupIndex=5 log4cplus.appender.DATA.layout=log4cplus::PatternLayout log4cplus.appender.DATA.layout.ConversionPattern=%D{%d/%b/%y %H:%M:%S.%q} %-9c %-5p %m%n I am not sure on the exact version of log4cplus however a locate resulted in the following /usr/lib/liblog4cplus-1.0.so.4 /usr/lib/liblog4cplus-1.0.so.4.0.0 /usr/lib/liblog4cplus-1.0.so.4.0.0_load /usr/lib/liblog4cplus.so Copying from my SO answer<http://stackoverflow.com/q/24422449/341065>: Since log4cplus 1.1.0-RC10 you can specify locale to be imbued into std::filestream used by file appenders. See FileAppender documentation<http://log4cplus.sourceforge.net/docs/html/classlog4cplus_1_1FileAppender.html>, especially the Locale property. In your case, try to imbue it with en_US.UTF-8. -- VZ ::DISCLAIMER:: ---------------------------------------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects. ---------------------------------------------------------------------------------------------------------------------------------------------------- |