|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Reloading log4j.properties file? |
« View previous topic :: View next topic » |
Author |
Message
|
TonyD |
Posted: Mon Nov 17, 2008 3:18 pm Post subject: Reloading log4j.properties file? |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Has anyone implemented an approach for reloading the log4j.properties file that avoids the need to restart the message broker? |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Tue Nov 18, 2008 4:52 am Post subject: Re: Reloading log4j.properties file? |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
TonyD wrote: |
Has anyone implemented an approach for reloading the log4j.properties file that avoids the need to restart the message broker? |
Do you have to use log4j.properties file ?
Log4J lets you set propertis manually in your code:
Code: |
log = Logger.getLogger(file);
log.setAdditivity(false);
String logPattern="%-5p:%d{ISO8601}:%t:%m%n";
PatternLayout layout = new PatternLayout(logPattern);
String datePattern = "yyyy-MM-dd";
DailyRollingFileAppender appender=null;
appender =
new DailyRollingFileAppender(
layout,
file,
datePattern);
|
Why dont you use here UDP to set log4J properties ?
Then you could use TimerNode to change it without restarting broker. _________________ Marcin |
|
Back to top |
|
 |
hopsala |
Posted: Tue Nov 18, 2008 6:09 am Post subject: Re: Reloading log4j.properties file? |
|
|
 Guardian
Joined: 24 Sep 2004 Posts: 960
|
marcin.kasinski wrote: |
Why dont you use here UDP to set log4J properties ?
Then you could use TimerNode to change it without restarting broker. |
??
UDP variables can only be given a value once, at design time or bar deploy time. From the lit:
Quote: |
A user-defined property (UDP) is a user-defined constant whose initial value can be modified, at design time, by the Message Flow editor, or overridden, at deployment time, by the Broker Archive editor. |
AFAIK, the only way to do what you want is to use a database, with a singleton pattern used to refresh. |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Tue Nov 18, 2008 6:25 am Post subject: Re: Reloading log4j.properties file? |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
hopsala wrote: |
marcin.kasinski wrote: |
Why dont you use here UDP to set log4J properties ?
Then you could use TimerNode to change it without restarting broker. |
??
UDP variables can only be given a value once, at design time or bar deploy time. From the lit:
Quote: |
A user-defined property (UDP) is a user-defined constant whose initial value can be modified, at design time, by the Message Flow editor, or overridden, at deployment time, by the Broker Archive editor. |
AFAIK, the only way to do what you want is to use a database, with a singleton pattern used to refresh. |
It was just shortcut
My proposal was:
Use UDP (connection data) to read new parameters (from DB, LDAP, …)
Then use these red data in your log4J code. _________________ Marcin |
|
Back to top |
|
 |
JLRowe |
Posted: Tue Nov 18, 2008 7:06 am Post subject: Re: Reloading log4j.properties file? |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
TonyD wrote: |
Has anyone implemented an approach for reloading the log4j.properties file that avoids the need to restart the message broker? |
I assume your code is calling log4j through a custom node or ESQL procedure. I think there is a java system property you can set for log4j, that tells it to kick off a thread to refresh the logging.
http://marc.info/?l=log4j-user&m=118778942431123&w=2
Otherwise, your only option is to write code to kick that thread off yourself, or do as we do and write a logging facade in java that refreshes the logging at set intervals. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|