Re: Can't figure out how to change email appender subject dynamically
Maarten, That was it! Calling appender.activateOptions(); did the trick. Thanks SO much! David. Maarten Bosteels-4 wrote: I haven't tried it, but maybe it helps to call activateOptions() Like this: appender.setSubject(currEnv.toUpperCase()+: +appender.getSubject()); appender.activateOptions() Maarten -- View this message in context: http://www.nabble.com/Can%27t-figure-out-how-to-change-email-appender-subject-dynamically-tf2416386.html#a6754657 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logging into different files
Have an application where the number of threads that get launched are dynamic. Could be anywhere from 1 to 300 threads that could get launched at runtime. I would like to know if it is possible to setup a file appender for each thread and have the indiv threads write to their own file appender. Currently all threads write to one log file using 1 file appender in a log4j.properties file but would like ability for each thread to log its own messages for easier debugging. Any good sites or source would be great. Any help would be appreciated. -- View this message in context: http://www.nabble.com/logging-into-different-files-tf2422885.html#a6754850 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logging into different files
This was discussed a lot on this list. Search in archive, keywords: MDC, RepositorySelector, different files. We currently discuss on the developper list the introduction of a MultiFileAppender which addresses just your need. But the work is still in progress... Heri -Original Message- From: sudhakardvvn [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 11, 2006 1:49 PM To: log4j-user@logging.apache.org Subject: [SPAM (Bayesain Analysis)] - logging into different files - Bayesian Filter detected spam Have an application where the number of threads that get launched are dynamic. Could be anywhere from 1 to 300 threads that could get launched at runtime. I would like to know if it is possible to setup a file appender for each thread and have the indiv threads write to their own file appender. Currently all threads write to one log file using 1 file appender in a log4j.properties file but would like ability for each thread to log its own messages for easier debugging. Any good sites or source would be great. Any help would be appreciated. -- View this message in context: http://www.nabble.com/logging-into-different-files-tf2422885.h tml#a6754850 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I change log4j configuration programatically?
A stand-alone Java application could use DOMConfigurator.configureAndWatch (but don't allow it to do automatic configuration). On 10/10/06, vincentw [EMAIL PROTECTED] wrote: I'm don't quite understand the question. it's a java application. James Stauffer wrote: In what kind of environment are you running? On 10/10/06, vincentw [EMAIL PROTECTED] wrote: Hi I'm new to using log4j and would like to know if I can change the configuration of log4j while it is already running. I have passed my log4j.xml to the DOMConfigurator and then I would like to change some settings. Here is my log4j.xml file ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=false !-- ==Appenders== -- !-- Define asyncAppender -- appender name=ASYNC class=org.apache.log4j.AsyncAppender appender-ref ref=STDOUT/ appender-ref ref=R/ /appender !-- Define STDOUT to a console -- appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ISO8601} %-17X{ipAddress} [%t] [%p] - %m%n/ /layout /appender !-- Define R; Rolling file logger -- appender name=R class=org.apache.log4j.RollingFileAppender param name=File value=logs/adminlog.txt/ param name=MaxFileSize value=100KB/ param name=MaxBackupIndex value=1/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ISO8601} %-17X{ipAddress} [%t] [%p] - %m%n/ /layout /appender logger name=sql level value=off/ /logger !-- ==Setup the Root category== -- !-- rules for logging DEBUGINFOWARNERRORFATAL. -- root priority value = error/ appender-ref ref=ASYNC/ /root /log4j:configuration Now based on a user config file, I would like to change some of the config such as the MaxFileSize of the rolling file appender or the number of backup logs it keeps. I would also like to change the logging level of root or sql. Is it possible to to this? If so, how do I go about doing this? Thanks in advance -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6747745 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6750178 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logging into different files
That should be possible by writing your own appender. Search the archives as this was discussed recently. On 10/11/06, sudhakardvvn [EMAIL PROTECTED] wrote: Have an application where the number of threads that get launched are dynamic. Could be anywhere from 1 to 300 threads that could get launched at runtime. I would like to know if it is possible to setup a file appender for each thread and have the indiv threads write to their own file appender. Currently all threads write to one log file using 1 file appender in a log4j.properties file but would like ability for each thread to log its own messages for easier debugging. Any good sites or source would be great. Any help would be appreciated. -- View this message in context: http://www.nabble.com/logging-into-different-files-tf2422885.html#a6754850 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I change log4j configuration programatically?
I see...no it's just a standalone Java application. James is probably wondering whether your code is running in a web container, such as Tomcat. In that case, LogWeb might be able to help http://www.codeczar.com/products/logweb/ It works great for me! Jake -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6757073 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logging into different files
I think that you could use something like: PatternLayout pattern = new PatternLayout(your pattern); String filename = some file name based on thread name; FileAppender threadAppender = new FileAppender(pattern, filename); String threadLogName = some log name derived from thread name; Logger threadLog = Logger.getLogger(threadLogName); threadLog.setAdditivity(false); threadLog.addAppender(threadLog); Michael Giroux On 10/11/06, sudhakardvvn [EMAIL PROTECTED] wrote: Have an application where the number of threads that get launched are dynamic. Could be anywhere from 1 to 300 threads that could get launched at runtime. I would like to know if it is possible to setup a file appender for each thread and have the indiv threads write to their own file appender. Currently all threads write to one log file using 1 file appender in a log4j.properties file but would like ability for each thread to log its own messages for easier debugging. Any good sites or source would be great. Any help would be appreciated. -- View this message in context: http://www.nabble.com/logging-into-different-files-tf2422885.html#a6754850 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I change log4j configuration programatically?
Well, I use DOMConfigurator initially, but what about when the program is running?? I would like to set a new root level or a log file size. Can I do something like Logger.getRootLogger.setLevel or something like that? If I do it this way do I have to stop and restart the logger? James Stauffer wrote: A stand-alone Java application could use DOMConfigurator.configureAndWatch (but don't allow it to do automatic configuration). -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6760580 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I change log4j configuration programatically?
Using configureAndWatch you can just change the file and it will update based on the changes. On 10/11/06, vincentw [EMAIL PROTECTED] wrote: Well, I use DOMConfigurator initially, but what about when the program is running?? I would like to set a new root level or a log file size. Can I do something like Logger.getRootLogger.setLevel or something like that? If I do it this way do I have to stop and restart the logger? James Stauffer wrote: A stand-alone Java application could use DOMConfigurator.configureAndWatch (but don't allow it to do automatic configuration). -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6760580 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I change log4j configuration programatically?
What would I call activateOptions() with? Bender Heri wrote: Yes, you can. Don't forget to call activateOptions() at the end of reconfiguring. You need not to restart the app. Heri -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6762094 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I change log4j configuration programatically?
I believe you call it on the appender after you change its settings. On 10/11/06, vincentw [EMAIL PROTECTED] wrote: What would I call activateOptions() with? Bender Heri wrote: Yes, you can. Don't forget to call activateOptions() at the end of reconfiguring. You need not to restart the app. Heri -- View this message in context: http://www.nabble.com/Can-I-change-log4j-configuration-programatically--tf2420301.html#a6762094 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]