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 Hein Meling <me...@acm.org> on 2005/08/17 11:53:30 UTC

Using property to set logger level

Hi

Is it not possible to set the logger level using something like:

  <logger name="registry.RegistryImpl" additivity="true">
    <level value="${registry.stdout.log.level}"/>
    <appender-ref ref="STDOUT"/>
  </logger>

I'm using properties to configure the file name of appenders (see below)
and thought that the above would work, but it didn't.

The reason I want this, is since I have two different ways of starting
the RegistryImpl class and I want to reduce the level of log stuff that
gets sent to STDOUT in one case but not in the other.  I would like to
avoid having two separate log4j.xml files for such a minor change.

Any reason why not allow this, or is it just not implemented? I'm using
log4j v1.3 alpha3.


Thanks,

Hein



  <appender name="FILE" class="org.apache.log4j.FileAppender">
    <param name="file"
value="${log.dir}/${log.app}-${log.machine}-${log.time}.log"/>
    <param name="BufferedIO" value="false"/>
    <param name="append" value="false"/>
    <param name="Threshold" value="debug"/>
    <layout class="org.apache.log4j.PatternLayout">
      <conversionRule conversionWord="tid"
converterClass="jgroup.util.ThreadIdPatternConverter"/>
      <param name="ConversionPattern" value="%-7r %-5p [%t-%tid]%
X{group} %x %c{2}.%M: %m%n"/>
    </layout>
  </appender>




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


Re: Using property to set logger level

Posted by James Stauffer <st...@gmail.com>.
You could use different log4j.xml files for each way to start the program.

On 8/17/05, Hein Meling <me...@acm.org> wrote:
> The reason I want this, is since I have two different ways of starting
> the RegistryImpl class and I want to reduce the level of log stuff that
> gets sent to STDOUT in one case but not in the other.  I would like to
> avoid having two separate log4j.xml files for such a minor change.

-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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