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 "alessio.ronchi@inwind.it" <al...@inwind.it> on 2003/02/03 12:41:41 UTC
Re:Real-time configuration for a bean inside application server
Hi everybody,
unfortunately nobody answered me at my previous mail (shown below) about logging for a bean.
Now, I 'm wondering whether I did not receive any answer because mine is a complicated problem that nobody has already investigated, or I'm following a completely wrong way or I haven't been able to explain my problem properly or something else.
What's the reason, please? :-)
Thanks in advance,
best regards,
Alessio
___________________________________________________________________________
>Hi everybody,
>I'm trying to have a bean inside the application server be able to log, with
>the possibility to change at run-time the configuration, by changing the
>log4j.properties.
>My bean has the following initialization:
>PropertyConfigurator.configureAndWatch(log4j.properties,5000);
>In this way every time the bean is invoked I'm sure the configuration file
>(log4j.properties, which is inside the classpath of the application server)
>is read.
>The problem is that currently, the bean is able to log, but if I change
>something (i.e. the file where to write the log) in the lo4j.properties,
>this change is not recognized.
>For your information, I add my log4j.properties: be aware that I've added my
>own new level, and for this reason I added the following classes (which are
>similar to the homonym classes inside the downloaded log4j-1.2.7.zip file):
>-MyLogger
>-MyLoggerFactory
>-MyLogLevel
>Is maybe wrong the bean initialization (I did it for a servlet and worked)?
>Or maybe the log4j.properties file?
>Any suggestion is really really appreciated.
>Thank you very much in advance.
>Bye
>Alessio
>aleron76@hotmail.com
>_____________________________________________________
>log4j.loggerFactory=com.mylog.MyLoggerFactory
>log4j.category.com.primo.al.PRIMOBean=DEBUG, dest2
>#dest2
>log4j.appender.dest2=org.apache.log4j.RollingFileAppender
>log4j.appender.dest2.Threshold=INFO
>log4j.appender.dest2.File=E:/temp/log4j.log
>log4j.appender.dest2.Append=true
>log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
>log4j.appender.dest2.layout.ConversionPattern=[%d{yyyy-MMM-dd
>hh:mm},%6.6r]%-5p[%t]%x(%F:%L) - %m%n
>log4j.appender.dest2.MaxFileSize=100KB
>log4j.appender.dest2.MaxBackupIndex=2
>_________________________________________________________________
>Comunica le tue emozioni in tempo reale con MSN Messenger!
>http://messenger.msn.it
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re:Real-time configuration for a bean inside application server
Posted by Jacob Kjome <ho...@visi.com>.
What exactly isn't getting recognized? What are you changing? The only
thing that I know can be done using configureAndWatch is to add
loggers. Someone please correct me if I am wrong here. So, you can add
them, but removing them from the properties file will not cause a
particular logger from being removed from the logger Hierarchy. The only
way to remove them from there is programatically. configureAndWatch() is
pretty limited.
Jake
At 12:41 PM 2/3/2003 +0100, you wrote:
>Hi everybody,
>unfortunately nobody answered me at my previous mail (shown below) about
>logging for a bean.
>
>Now, I 'm wondering whether I did not receive any answer because mine is a
>complicated problem that nobody has already investigated, or I'm following
>a completely wrong way or I haven't been able to explain my problem
>properly or something else.
>
>What's the reason, please? :-)
>
>Thanks in advance,
>best regards,
>Alessio
>
>___________________________________________________________________________
> >Hi everybody,
> >I'm trying to have a bean inside the application server be able to log,
> with
> >the possibility to change at run-time the configuration, by changing the
> >log4j.properties.
>
> >My bean has the following initialization:
> >PropertyConfigurator.configureAndWatch(log4j.properties,5000);
>
> >In this way every time the bean is invoked I'm sure the configuration file
> >(log4j.properties, which is inside the classpath of the application server)
> >is read.
>
> >The problem is that currently, the bean is able to log, but if I change
> >something (i.e. the file where to write the log) in the lo4j.properties,
> >this change is not recognized.
>
> >For your information, I add my log4j.properties: be aware that I've
> added my
> >own new level, and for this reason I added the following classes (which are
> >similar to the homonym classes inside the downloaded log4j-1.2.7.zip file):
> >-MyLogger
> >-MyLoggerFactory
> >-MyLogLevel
>
> >Is maybe wrong the bean initialization (I did it for a servlet and worked)?
> >Or maybe the log4j.properties file?
>
> >Any suggestion is really really appreciated.
> >Thank you very much in advance.
>
> >Bye
> >Alessio
> >aleron76@hotmail.com
>
>
> >_____________________________________________________
> >log4j.loggerFactory=com.mylog.MyLoggerFactory
>
> >log4j.category.com.primo.al.PRIMOBean=DEBUG, dest2
>
>
> >#dest2
> >log4j.appender.dest2=org.apache.log4j.RollingFileAppender
> >log4j.appender.dest2.Threshold=INFO
> >log4j.appender.dest2.File=E:/temp/log4j.log
> >log4j.appender.dest2.Append=true
> >log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
> >log4j.appender.dest2.layout.ConversionPattern=[%d{yyyy-MMM-dd
> >hh:mm},%6.6r]%-5p[%t]%x(%F:%L) - %m%n
> >log4j.appender.dest2.MaxFileSize=100KB
> >log4j.appender.dest2.MaxBackupIndex=2
>
> >_________________________________________________________________
> >Comunica le tue emozioni in tempo reale con MSN Messenger!
> >http://messenger.msn.it
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org