Re: Setting properties for log4j.xml configuration file

2011-03-13 Thread Thomas Wiedmann
Meanwhile I found the solution (for all, who'll might have the same question 
in future:) by defining an XML entity declaring the logfiles directory (or 
any other parameter, required, to be referenced in the log4j.xml) - Sample:


?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd [!ENTITY log4j:logDir 
C:/MyProject/MyLogs]


log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
  appender name=fileout 
class=org.apache.log4j.DailyRollingFileAppender

param name=file value=log4j:logDir;/mytests.log/

Thomas Wiedmann
...



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



Re: Setting properties for log4j.xml configuration file

2011-02-22 Thread Jacob Kjome


You're right, I did miss something.  I didn't see log4j.logdir being set 
within the file in the original example.  Sorry about that.  Your original 
answer appears to be right on the money.


Jake


On Mon, 21 Feb 2011 22:54:31 -0600
 Curt Arnold carn...@apache.org wrote:
I read the question as how do I define parameters once in an XML 
configuration file and the use of system properties was just a convenient way 
of doing that in property file configurations.  The property file example 
included setting log4j.logdir in the file and I'm not aware of any capability 
in XML configuration files to set system properties.  If the property was 
already set externally, then you could use the same type of expressions as in 
the example.




On Feb 21, 2011, at 8:05 PM, Jacob Kjome wrote:



Curt,

Maybe I'm missing something, but how does using XML entity refs do anything 
for
referencing Java system properties?  The simple answer is that Log4j XML 
config

files support exactly the same syntax as properties files, e.g.,

param name=File value=${log4j.logdir}/MyAppender1.log/

I don't recall whether/where it's specifically documented or not, but it 
works.



Jake

On 2/20/2011 10:30 PM, Curt Arnold wrote:
XML entity references can be used for that purpose and are defined in the 
XML Recommendation (http://www.w3.org/TR/xml/#sec-references).


!DOCTYPE log4j:configuration
[
!ENTITY logdir c:/data/logfiles
]
log4j:configuration
...
param name=file value=logdir;/
...
/log4j:configuration

On Feb 20, 2011, at 6:35 AM, Thomas Wiedmann wrote:


Hello,

usually in flat plain text log4j.config files global system properties can 
be defined, which may be referenced in the configuration of different 
appenders, e. g.


log4j.logdir=C:/Data/logfiles
...
log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
...
log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log

I found this is a very convenient way to define (and to administer) such 
parameters only once globally for the entire log configuration and to use it 
on several references as here in the appenders configuration.


How can such global system properties be defined in xml-based configuration 
files (log4j.xml)?

Where is it documented? I'd found no hint about it.

Thomas Wiedmann 



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




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






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




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





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



Re: Setting properties for log4j.xml configuration file

2011-02-21 Thread Jacob Kjome

Curt,

Maybe I'm missing something, but how does using XML entity refs do anything for
referencing Java system properties?  The simple answer is that Log4j XML config
files support exactly the same syntax as properties files, e.g.,

param name=File value=${log4j.logdir}/MyAppender1.log/

I don't recall whether/where it's specifically documented or not, but it works.


Jake

On 2/20/2011 10:30 PM, Curt Arnold wrote:
 XML entity references can be used for that purpose and are defined in the XML 
 Recommendation (http://www.w3.org/TR/xml/#sec-references).
 
 !DOCTYPE log4j:configuration
 [
 !ENTITY logdir c:/data/logfiles
 ]
 log4j:configuration
 ...
 param name=file value=logdir;/
 ...
 /log4j:configuration
 
 On Feb 20, 2011, at 6:35 AM, Thomas Wiedmann wrote:
 
 Hello,

 usually in flat plain text log4j.config files global system properties can 
 be defined, which may be referenced in the configuration of different 
 appenders, e. g.

 log4j.logdir=C:/Data/logfiles
 ...
 log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
 ...
 log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log

 I found this is a very convenient way to define (and to administer) such 
 parameters only once globally for the entire log configuration and to use it 
 on several references as here in the appenders configuration.

 How can such global system properties be defined in xml-based configuration 
 files (log4j.xml)?
 Where is it documented? I'd found no hint about it.

 Thomas Wiedmann 


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

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

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



Re: Setting properties for log4j.xml configuration file

2011-02-21 Thread Curt Arnold
I read the question as how do I define parameters once in an XML 
configuration file and the use of system properties was just a convenient way 
of doing that in property file configurations.  The property file example 
included setting log4j.logdir in the file and I'm not aware of any capability 
in XML configuration files to set system properties.  If the property was 
already set externally, then you could use the same type of expressions as in 
the example.



On Feb 21, 2011, at 8:05 PM, Jacob Kjome wrote:

 
 Curt,
 
 Maybe I'm missing something, but how does using XML entity refs do anything 
 for
 referencing Java system properties?  The simple answer is that Log4j XML 
 config
 files support exactly the same syntax as properties files, e.g.,
 
   param name=File value=${log4j.logdir}/MyAppender1.log/
 
 I don't recall whether/where it's specifically documented or not, but it 
 works.
 
 
 Jake
 
 On 2/20/2011 10:30 PM, Curt Arnold wrote:
 XML entity references can be used for that purpose and are defined in the 
 XML Recommendation (http://www.w3.org/TR/xml/#sec-references).
 
 !DOCTYPE log4j:configuration
 [
 !ENTITY logdir c:/data/logfiles
 ]
 log4j:configuration
 ...
 param name=file value=logdir;/
 ...
 /log4j:configuration
 
 On Feb 20, 2011, at 6:35 AM, Thomas Wiedmann wrote:
 
 Hello,
 
 usually in flat plain text log4j.config files global system properties can 
 be defined, which may be referenced in the configuration of different 
 appenders, e. g.
 
 log4j.logdir=C:/Data/logfiles
 ...
 log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
 ...
 log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log
 
 I found this is a very convenient way to define (and to administer) such 
 parameters only once globally for the entire log configuration and to use 
 it on several references as here in the appenders configuration.
 
 How can such global system properties be defined in xml-based configuration 
 files (log4j.xml)?
 Where is it documented? I'd found no hint about it.
 
 Thomas Wiedmann 
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 


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



Re: Setting properties for log4j.xml configuration file

2011-02-21 Thread Thomas Wiedmann
... and I'm not aware of any capability in XML configuration files to set 
system properties.
Yes, exactly this is my main question (How to set a property, which can be 
referenced in the xml config elsewhere? It works in flat log4j text config 
files) - it's still open. Unfortunately I didn't even found a hint about it 
in the link http://wiki.apache.org/logging-log4j/Log4jXmlFormat.


Thomas Wiedmann


On Feb 21, 2011, at 8:05 PM, Jacob Kjome wrote:



Curt,

Maybe I'm missing something, but how does using XML entity refs do 
anything for
referencing Java system properties?  The simple answer is that Log4j XML 
config

files support exactly the same syntax as properties files, e.g.,

   param name=File value=${log4j.logdir}/MyAppender1.log/

I don't recall whether/where it's specifically documented or not, but it 
works.



Jake

On 2/20/2011 10:30 PM, Curt Arnold wrote:
XML entity references can be used for that purpose and are defined in the 
XML Recommendation (http://www.w3.org/TR/xml/#sec-references).


!DOCTYPE log4j:configuration
[
!ENTITY logdir c:/data/logfiles
]
log4j:configuration
...
param name=file value=logdir;/
...
/log4j:configuration

On Feb 20, 2011, at 6:35 AM, Thomas Wiedmann wrote:


Hello,

usually in flat plain text log4j.config files global system properties 
can be defined, which may be referenced in the configuration of 
different appenders, e. g.


log4j.logdir=C:/Data/logfiles
...
log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
...
log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log

I found this is a very convenient way to define (and to administer) such 
parameters only once globally for the entire log configuration and to 
use it on several references as here in the appenders configuration.


How can such global system properties be defined in xml-based 
configuration files (log4j.xml)?

Where is it documented? I'd found no hint about it.

Thomas Wiedmann


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




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






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





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



Setting properties for log4j.xml configuration file

2011-02-20 Thread Thomas Wiedmann

Hello,

usually in flat plain text log4j.config files global system properties can 
be defined, which may be referenced in the configuration of different 
appenders, e. g.


log4j.logdir=C:/Data/logfiles
...
log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
...
log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log

I found this is a very convenient way to define (and to administer) such 
parameters only once globally for the entire log configuration and to use it 
on several references as here in the appenders configuration.


How can such global system properties be defined in xml-based configuration 
files (log4j.xml)?

Where is it documented? I'd found no hint about it.

Thomas Wiedmann 




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



Re: Setting properties for log4j.xml configuration file

2011-02-20 Thread Christian Grobmeier
Hi,

actually you are right. I think we should improve our documentation here.
In meanwhile, please try this:
http://wiki.apache.org/logging-log4j/Log4jXmlFormat

Let me know if this solves your problems.

Cheers
Christian

On Sun, Feb 20, 2011 at 1:35 PM, Thomas Wiedmann th...@gmx.de wrote:
 Hello,

 usually in flat plain text log4j.config files global system properties can
 be defined, which may be referenced in the configuration of different
 appenders, e. g.

 log4j.logdir=C:/Data/logfiles
 ...
 log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
 ...
 log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log

 I found this is a very convenient way to define (and to administer) such
 parameters only once globally for the entire log configuration and to use it
 on several references as here in the appenders configuration.

 How can such global system properties be defined in xml-based configuration
 files (log4j.xml)?
 Where is it documented? I'd found no hint about it.

 Thomas Wiedmann


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





-- 
http://www.grobmeier.de

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



Re: Setting properties for log4j.xml configuration file

2011-02-20 Thread Curt Arnold
XML entity references can be used for that purpose and are defined in the XML 
Recommendation (http://www.w3.org/TR/xml/#sec-references).

!DOCTYPE log4j:configuration
[
!ENTITY logdir c:/data/logfiles
]
log4j:configuration
...
param name=file value=logdir;/
...
/log4j:configuration

On Feb 20, 2011, at 6:35 AM, Thomas Wiedmann wrote:

 Hello,
 
 usually in flat plain text log4j.config files global system properties can be 
 defined, which may be referenced in the configuration of different appenders, 
 e. g.
 
 log4j.logdir=C:/Data/logfiles
 ...
 log4j.appender.MyAppender1.File=${log4j.logdir}/MyAppender1.log
 ...
 log4j.appender.MyAppender2.File=${log4j.logdir}/MyAppender2.log
 
 I found this is a very convenient way to define (and to administer) such 
 parameters only once globally for the entire log configuration and to use it 
 on several references as here in the appenders configuration.
 
 How can such global system properties be defined in xml-based configuration 
 files (log4j.xml)?
 Where is it documented? I'd found no hint about it.
 
 Thomas Wiedmann 
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 


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