logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Schöning <tschoen...@am-soft.de>
Subject Re: how to retain values using configureAndWatch()
Date Fri, 21 Feb 2014 09:18:08 GMT
Guten Tag Nandan S,
am Freitag, 21. Februar 2014 um 04:19 schrieben Sie:

>    Is there anyway  the values set in program can be retained after
> reloading the configuration file by configureAndWatch() method.

Doesn't look like, what you could do is overriding
DOMConfigurator::configureAndWatch from domconfigurator.cpp with an
own implementation, which doesn't use the default XMLWatchdog, but
again another subclass of those from your which overrides the method
doOnChange. Both implementations seem fairly easy and you only need to
call the base of doOnChange and afterwards your code to change the
configuration.

If you don't want to take this effort your best bet would be to not
use hard coded filenames, but simply something like environment
variables which can be set differently in the rpogram using your log
configuration. In the following example ${mandant} is coming from the
env set by the application:

                <rollingPolicy  class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
                        <param  name="FileNamePattern"
                                        value="..\..\..\Datenserver\Logdateien\dbxml\dbxml\${mandant}\%d{yyyy-MM}.log"
                        />
                </rollingPolicy>

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail:Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


Mime
View raw message