On Apr 8, 2009, at 4:17 AM, Lijuan Zhu wrote:
I am new to Log4cxx, and just got it into my projects. I have two
questions now:
1, The log file I specified in the xml configuration file should
exist? how to change the configuration so the log4cxx could create
the log file if it does not exist?
log4cxx should attempt to create the file specified if it does not
exist, perhaps you are running your application with reduced
privileges that prevent it from writing to the directory to create the
file?
2. I could not log Chinese characters into the log file (there are
something like this:2009-04-08 10:02:29,68? ERROR [ps.?f]??????), is
there any setting I can change to make it show the logs correctly?
Thanks a lot,
Lijuan
Unless you specify otherwise, log4cxx will use the default encoding of
your operating system if it can detect it. If you default encoding is
something like ISO-8859-1 or USASCII, they are incapable of
representing Asian characters. The easiest way would be to specify
<param name="encoding" value="UTF-8"/>
or
<param name="encoding" value="UTF-16"/>