On Dec 5, 2006, at 7:45 AM, Sorin POPA wrote:
Hello, amigos!
There are two things I would like to ask advice for:
1. I would like to validate the XML configuration file for
log4cxx in the project I am using.
There is a "log4j.dtd" document in the 0.9.8 version from SVN which
should serve this purpose.
The thing with this DTD is that there is no definition for an
element named "rollingPolicy" inside an "appender" element. This is
observable by looking inside the DTD; we've tried to validate the
XML configuration with Eclipse and its XML plugin and the result
was the following:
The content of element type "appender" must match
"(errorHandler?,param*,layout?,filter*,appender-ref*)".
Is there something missing in the DTD file? The logger functions
alright with the "rollingPolicy" element included in the XML
configuration. So, this seems to be correctly specified.
The DTD was copied from the log4j project which has the same defect.
log4j never uses the log4j.dtd and was not apparently kept in sync
when new element types were added. The correct resolution to it
would be to log a bug report for log4j and at least check all the
test xml configuration files against the DTD as part of the build
process and then move that over to log4cxx.
!!! I need to mention that the use of a PROPERTIES file in the case
of having ANY kind of policies for logging (time based policies,
rolling policies..) is not advisable as it seems that the policies
don't work with other types of config files, but XML config files.
This might be another issue....
I have read this on a log4cxx related discussion, but unfortunately
I can't tell you where and I can't provide a link.
Should also be true for log4j.
2. Could anyone confirm the following being correct in the XML
config file for log4cxx?...
<param name="Encoding" value="UTF-16"/>
I am using this to change the encoding of the log files to Unicode
(the intention is to display Japanese, Arabic and other types of
characters from other character sets) inside the <appender> ... </
appender> element in the XML file.
Should be but there are no tests that attempt to set the encoding
through configuration files. All the unit tests use explicit
setEncoding calls.