bugzilla
Thu, 15 Jul 2010 05:48:43 -0700
https://issues.apache.org/bugzilla/show_bug.cgi?id=49597
Summary: The log4j.dtd is to restrictive
Product: Log4j
Version: 1.2
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P2
Component: Configurator
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: a.kr...@science-computing.de
Created an attachment (id=25763)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25763)
A relaxed DTD that allows ${} substitutions within "name" attributes
The log4j XML configuration supports ${...} replacements within attribute
values. This works fine.
Problem
In my application, I need to use the ${...} substitution within the
"name"-attribute of an appender. (This way I can switch the appenders depending
on the operation mode of the application.)
<appender name="console${sc.fg.log4j.fgMode.gui}" .../>
Unfortunately, this does not work, if the log4j XML config file is read by
the log4j DomConfigurator, because the log4j-DTD is too restrictive. The
DTD doesn't take variable substitutions (${..}) into account.
Possible Fix
Change the DTD or provide an alternative relaxed DTD. See the attached
log4j-relaxed.dtd for an example.
The modification changes IDREF values to CDATA and enumerated attribute values
to CDATA. This is required, if the attribute value contains variable
substitutions (${...}).
My current Workaround:
The log4j DomConfigurator also accepts an DOM-Element and
this way, I do the parsing myself using the relaxed DTD and feed the resulting
DOM to the DomConfigurator.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org