You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Michael Rimov <ri...@centercomp.com> on 2002/11/21 10:51:59 UTC

Initialization Question

Hey all,

A quick question.

We've been using Log4j for the Expresso project since before it moved to 
Jakarta, and it has been extremely faithful.  I've been working on how to 
better set up xml configuration with log4j since DOM configuration has 
obviously matured greatly since we first dealt with it. :)

The only reason left for using a custom configurator AFAICT is because we 
expand various properties in the DOM configuration.  For example, we define 
a LOG_DIR property that my configuration loader expands with our desired 
values.

However, I would LOVE to see our own custom configurator done away with 
alltogether.  I realized that when installing JBoss on my system, that I 
never had to modify the log4j.xml file so that it starting logging in the 
right location, so I took a look at this and found:

<appender name="FILE" 
class="org.jboss.logging.appender.DailyRollingFileAppender">
<param name="File" value="${jboss.server.home.dir}/log/server.log"/>
                           ^^^^^^^^^^^^^^^^^^^^^^^

.....

Does log4j now support 'ANT-like' properties expansions like that listed 
above where I can set Java properties and have it expanded properly in 
DOMConfigurator or is JBoss' custom DailyRollingFileAppender doing this??

If log4j DOESN'T do it already, may I ask for it to be put on the feature 
request list? ;)

Thanks for your time in advance!
                                                 -Mike



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Initialization Question

Posted by Michael Rimov <ri...@centercomp.com>.
At 10:38 AM 11/21/2002 +0000, you wrote:
>Log4j has supported system properties interpolation in XML/properties
>configuration files at least since I started using it (almost two years
>ago).
>
>Just add the variables to system properties before Log4j fires up, e.g. with
>the -D option to the VM.

Whoo hoo!  Great news! I must have been sleeping!  What a way to wake 
up!  Yippie!.... in other words:

Thanks, I'm glad that this will work! <grin>
                                                 -Mike



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Initialization Question

Posted by Fabien Modoux <fa...@voicemate.com>.
Thanks for your response, Ceki.

> >When using PropertyConfigurator I found this very convenient
> >and Ant has this feature in its xml build file. Has anyone
> >experience this and found a workaround for it? Is there any
> >reason this was not added or is it planned for future releases?
> 
> How do you envision this working? Can you please provide an example?
 
I was thinking about something similar to ant's syntax,

    <!-- Load properties from a file -->
    <property file="log4j.properties"/>

    <!-- Explicitely define a property -->
    <property name="smtp.host"   value="smtp.mycompany.com"/>

Not sure if this is feasible... the DTD would need to be updated
to support this new 'property' element.

The reason I asked, is because when using PropertyConfigurator, I found 
it convenient and easier to share and copy log files by having a 
section that defines the application dependent parameters at the
beginning of my configuration file and having the appenders unchanged
across applications and reference the variables... I started using 
DOMConfigurator in order to be able to use AsyncAppender.

Hope this helps.

Best regards,

Fabien

---------------------------------------------      
Fabien Modoux,
Voicemate - http://www.voicemate.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Initialization Question

Posted by Ceki Gülcü <ce...@qos.ch>.
At 14:15 21.11.2002 -0500, you wrote:
>Hello,
>
>I have just started using log4j's xml-based configuration
>and though it supports substitution for system properties,
>I have not found anything about defining generic variables
>that can be referenced in the configuration file.

You are right there is no way to define generic variables.

>When using PropertyConfigurator I found this very convenient
>and Ant has this feature in its xml build file. Has anyone
>experience this and found a workaround for it? Is there any
>reason this was not added or is it planned for future releases?

How do you envision this working? Can you please provide an example?

>Thank you in advance for your time.
>
>Fabien
>
>---------------------------------------------
>Fabien Modoux,
>Voicemate - http://www.voicemate.com
>
>
>
> > -----Original Message-----
> > From: Thomas Muller [mailto:ttm@online.no]
> > Sent: Thursday, November 21, 2002 5:39 AM
> > To: Log4J Users List
> > Subject: RE: Initialization Question
> >
> >
> > Log4j has supported system properties interpolation in XML/properties
> > configuration files at least since I started using it (almost
> > two years
> > ago).
> >
> > Just add the variables to system properties before Log4j
> > fires up, e.g. with
> > the -D option to the VM.
> >
> > --
> >
> > Thomas
> >
> > | -----Original Message-----
> > | From: Michael Rimov [mailto:rimovm@centercomp.com]
> > | Sent: 21 November 2002 09:52
> > | To: log4j-user@jakarta.apache.org
> > | Subject: Initialization Question
> > |
> > |
> > | Hey all,
> > |
> > | A quick question.
> > |
> > | We've been using Log4j for the Expresso project since
> > before it moved to
> > | Jakarta, and it has been extremely faithful.  I've been
> > working on how to
> > | better set up xml configuration with log4j since DOM
> > configuration has
> > | obviously matured greatly since we first dealt with it. :)
> > |
> > | The only reason left for using a custom configurator AFAICT
> > is because we
> > | expand various properties in the DOM configuration.  For example,
> > | we define
> > | a LOG_DIR property that my configuration loader expands
> > with our desired
> > | values.
> > |
> > | However, I would LOVE to see our own custom configurator
> > done away with
> > | alltogether.  I realized that when installing JBoss on my
> > system, that I
> > | never had to modify the log4j.xml file so that it starting
> > logging in the
> > | right location, so I took a look at this and found:
> > |
> > | <appender name="FILE"
> > | class="org.jboss.logging.appender.DailyRollingFileAppender">
> > | <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
> > |                            ^^^^^^^^^^^^^^^^^^^^^^^
> > |
> > | .....
> > |
> > | Does log4j now support 'ANT-like' properties expansions
> > like that listed
> > | above where I can set Java properties and have it expanded
> > properly in
> > | DOMConfigurator or is JBoss' custom
> > DailyRollingFileAppender doing this??
> > |
> > | If log4j DOESN'T do it already, may I ask for it to be put
> > on the feature
> > | request list? ;)
> > |
> > | Thanks for your time in advance!
> > |                                                  -Mike
> > |
> > |
> > |
> > | --
> > | To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> >
> >
> >
> > **************************************************************
> > ***********
> > Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All
> > rights reserved.
> > The information supplied in this Commercial Communication
> > should be treated
> > in confidence.
> > No liability whatsoever is accepted for any loss or damage
> > suffered as a result of accessing this message or any attachments.
> >
> > ______________________________________________________________
> > __________
> > This email has been scanned for all viruses by the MessageLabs SkyScan
> > service. For more information on a proactive anti-virus
> > service working
> > around the clock, around the globe, visit http://www.messagelabs.com
> > ______________________________________________________________
> > __________
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:log4j-user-> unsubscribe@jakarta.apache.org>
> > For
> > additional commands,
> > e-mail: <ma...@jakarta.apache.org>
> >
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Initialization Question

Posted by Fabien Modoux <fa...@voicemate.com>.
Hello,

I have just started using log4j's xml-based configuration
and though it supports substitution for system properties,
I have not found anything about defining generic variables 
that can be referenced in the configuration file.

When using PropertyConfigurator I found this very convenient 
and Ant has this feature in its xml build file. Has anyone
experience this and found a workaround for it? Is there any
reason this was not added or is it planned for future releases?

Thank you in advance for your time.

Fabien 

---------------------------------------------      
Fabien Modoux,
Voicemate - http://www.voicemate.com



> -----Original Message-----
> From: Thomas Muller [mailto:ttm@online.no] 
> Sent: Thursday, November 21, 2002 5:39 AM
> To: Log4J Users List
> Subject: RE: Initialization Question
> 
> 
> Log4j has supported system properties interpolation in XML/properties
> configuration files at least since I started using it (almost 
> two years
> ago).
> 
> Just add the variables to system properties before Log4j 
> fires up, e.g. with
> the -D option to the VM.
> 
> --
> 
> Thomas
> 
> | -----Original Message-----
> | From: Michael Rimov [mailto:rimovm@centercomp.com]
> | Sent: 21 November 2002 09:52
> | To: log4j-user@jakarta.apache.org
> | Subject: Initialization Question
> |
> |
> | Hey all,
> |
> | A quick question.
> |
> | We've been using Log4j for the Expresso project since 
> before it moved to
> | Jakarta, and it has been extremely faithful.  I've been 
> working on how to
> | better set up xml configuration with log4j since DOM 
> configuration has
> | obviously matured greatly since we first dealt with it. :)
> |
> | The only reason left for using a custom configurator AFAICT 
> is because we
> | expand various properties in the DOM configuration.  For example,
> | we define
> | a LOG_DIR property that my configuration loader expands 
> with our desired
> | values.
> |
> | However, I would LOVE to see our own custom configurator 
> done away with
> | alltogether.  I realized that when installing JBoss on my 
> system, that I
> | never had to modify the log4j.xml file so that it starting 
> logging in the
> | right location, so I took a look at this and found:
> |
> | <appender name="FILE"
> | class="org.jboss.logging.appender.DailyRollingFileAppender">
> | <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
> |                            ^^^^^^^^^^^^^^^^^^^^^^^
> |
> | .....
> |
> | Does log4j now support 'ANT-like' properties expansions 
> like that listed
> | above where I can set Java properties and have it expanded 
> properly in
> | DOMConfigurator or is JBoss' custom 
> DailyRollingFileAppender doing this??
> |
> | If log4j DOESN'T do it already, may I ask for it to be put 
> on the feature
> | request list? ;)
> |
> | Thanks for your time in advance!
> |                                                  -Mike
> |
> |
> |
> | --
> | To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 
> 
> 
> 
> **************************************************************
> ***********
> Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All 
> rights reserved. 
> The information supplied in this Commercial Communication 
> should be treated
> in confidence.
> No liability whatsoever is accepted for any loss or damage 
> suffered as a result of accessing this message or any attachments.
> 
> ______________________________________________________________
> __________
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service. For more information on a proactive anti-virus 
> service working
> around the clock, around the globe, visit http://www.messagelabs.com
> ______________________________________________________________
> __________
> 
> --
> To unsubscribe, e-mail:   
> <mailto:log4j-user-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Initialization Question

Posted by Thomas Muller <tt...@online.no>.
Log4j has supported system properties interpolation in XML/properties
configuration files at least since I started using it (almost two years
ago).

Just add the variables to system properties before Log4j fires up, e.g. with
the -D option to the VM.

--

Thomas

| -----Original Message-----
| From: Michael Rimov [mailto:rimovm@centercomp.com]
| Sent: 21 November 2002 09:52
| To: log4j-user@jakarta.apache.org
| Subject: Initialization Question
|
|
| Hey all,
|
| A quick question.
|
| We've been using Log4j for the Expresso project since before it moved to
| Jakarta, and it has been extremely faithful.  I've been working on how to
| better set up xml configuration with log4j since DOM configuration has
| obviously matured greatly since we first dealt with it. :)
|
| The only reason left for using a custom configurator AFAICT is because we
| expand various properties in the DOM configuration.  For example,
| we define
| a LOG_DIR property that my configuration loader expands with our desired
| values.
|
| However, I would LOVE to see our own custom configurator done away with
| alltogether.  I realized that when installing JBoss on my system, that I
| never had to modify the log4j.xml file so that it starting logging in the
| right location, so I took a look at this and found:
|
| <appender name="FILE"
| class="org.jboss.logging.appender.DailyRollingFileAppender">
| <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
|                            ^^^^^^^^^^^^^^^^^^^^^^^
|
| .....
|
| Does log4j now support 'ANT-like' properties expansions like that listed
| above where I can set Java properties and have it expanded properly in
| DOMConfigurator or is JBoss' custom DailyRollingFileAppender doing this??
|
| If log4j DOESN'T do it already, may I ask for it to be put on the feature
| request list? ;)
|
| Thanks for your time in advance!
|                                                  -Mike
|
|
|
| --
| To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>




*************************************************************************
Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved. 
The information supplied in this Commercial Communication should be treated
in confidence.
No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>