logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mattias Andersson" <mailing_lists+lo...@caleotech.com>
Subject Re: Adding new tags to log4j XML configuration file
Date Tue, 19 Dec 2006 15:47:52 GMT
Hi,

> Hello
>
> I made a logserver too, and looking for a solution for merging my
> configurations and the standard log4j configuration for the logserver.
> So I'd like to modify the log4j config  schema or dtd too. What did you
> find out about it?
>

Nothing more really. I think you have to write the DTD so that it can be
extended. It probably means that the log4j.dtd need to modified. But I
havn't got any time to investigate this further right now. But I think you
could do something like this (totally untested)

log4j.dtd
-----------------------------------------------------------------

<!ENTITY % log4j.addon " " >
<!ELEMENT log4j:configuration (renderer*,
appender*,(category|logger)*,root?, categoryFactory? %log4jaddon;)>

log4j configuration xml file
-----------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" [
  <!ELEMENT server EMPTY >
  <!ATTLIST server port	CDATA #REQUIRED >
  <!ENTITY % log4j.addon " , server">
]>

Unfortunately my DTD skills is not that great. Have to catchup on that
someday ;)

Regards,
  /Mattias


> Thanks:
>     Bence
>
>
> Mattias Andersson wrote:
>> Hi,
>>
>> I'm using log4j 1.2.14 and I'd like to add my own tags to the log4j XML
>> configuration file. The reason for this is that we have built a logging
>> server and to avoid having two configuration files I'd like to add some
>> new tags to XML file.
>>
>> I've added the following to my XML file and the parser generates
>> (correctly) a waring about redefinition of log4j:configuration DTD
>> element. The parsing of the XML file works fine anyway it's just the
>> warning I'd like to avoid since users tends to notice warnings and ask
>> questions. Perhaps this warning can be turned of?
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" [
>>   <!ELEMENT log4j:configuration (renderer*,
>> appender*,(category|logger)*,root?,
>>                                  categoryFactory?, server)>
>>   <!ELEMENT server EMPTY >
>>   <!ATTLIST server
>>     port	CDATA	#REQUIRED >
>> ]>
>>
>> log4j:WARN Continuable parsing error 12 and column 50
>> log4j:WARN Element type "log4j:configuration" must not be declared more
>> than once.
>>
>> I'm not an expert on DTD but it should be possible to write the
>> log4j.dtd
>> so that you can add your own tags, or? Or have someone extended the XML
>> file and solved it in another way?
>>
>> Any help or pointers would be appreciated.
>>
>> Regards
>>  /Mattias
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message