RE: log4j stops logging at console
This problem was fixed in (I believe) jBoss 4.0.2. Of course in that same versions they screwed up other stuff... (i.e.: Hibernate would no longer work if you had it in your application) so you may or may not want to use that version anyway. But they are aware of the issues and I hope they will eventually fix all these problems. Good luck. Bruno Melloni Director of Software Architecture Akuratus Corporation 1333 N. Stemmons Fwy, Suite 110 Dallas, Texas 75207 Phone: 469.227.0920 Fax: 469.227.0967 [EMAIL PROTECTED] www.akuratus.com [EMAIL PROTECTED] 5/16/2005 11:38:55 AM JBoss, by current design, only provides for one logging context (ie LoggerRepository). On top of that, the JBoss log4j.xml also sets up a special CONSOLE appender that maps the System.out and System.err streams. If you do any kind of configuration after JBoss starts up that affects the console appender OR affects loggers that have been defined in the JBoss log4j.xml file, then it will affect the output to the log files. Especially Console, do not mess with Console. Also, if your log4j code ever calls LoggerRepository.shutdown() during a redeploy, then logging will be hosed as well. JBoss really needs to provide a better mechanism to allowing web apps and ejb's to do their own logging. Log4j does provide some layering of configuration where you can set up your own loggers and appenders as long as they are not references by the first/base configuration file. Or you can just add your logging stuff to the JBoss log4j.xml file directly. You may also find the following link useful, but I don't know if anyone has gotten to work correctly in JBoss or not. Seems to me that to be completely efficient, it would need to be supported pretty deep in the JBoss log4j initialization. http://www.qos.ch/logging/sc.jsp -Mark -Original Message- From: Clandes Tino [mailto:[EMAIL PROTECTED] Sent: Monday, May 16, 2005 6:51 AM To: log4j-user@logging.apache.org Subject: log4j stops logging at console Hello all. I am facing the problem with log4j usage in two separate applications. I am using CONSOLE appenders for both of them. Applications are started separately (in two shell windows). The first app (App1) is assembled as EAR and deployed under JBoss (it uses log4j.jar from JBoss/server/default/lib and initializes log4j through MBean, where appenders and loggers are configured). Here is the method in MBean that configures log4j in App1: --- private void initLog4j() throws ConfigurationException { final Properties props = new Properties(); props.setProperty(log4j.category.com.myapp, DEBUG, CONSOLE, FILE); props.setProperty(log4j.appender.CONSOLE,org.apache.log4j.ConsoleAppend er); props.setProperty(log4j.appender.CONSOLE.layout,org.apache.log4j.Patter nLayout) props.setProperty(log4j.appender.CONSOLE.layout.ConversionPattern,%d{IS O8601} %-5p [%c{1}] [%X{user}] - %m%n); props.setProperty(log4j.appender.FILE,org.apache.log4j.RollingFileAppen der); props.setProperty(log4j.appender.FILE.File, getConfigurationSetting(LOG_FILE)); props.setProperty(log4j.appender.FILE.MaxFileSize, getConfigurationSetting(MAX_FILE_SIZE)); props.setProperty(log4j.appender.FILE.MaxBackupIndex, getConfigurationSetting(MAX_BACKUP_FILE)); props.setProperty(log4j.appender.FILE.layout,org.apache.log4j.PatternLa yout); props.setProperty(log4j.appender.FILE.layout.ConversionPattern,%d{ISO86 01} %-5p [%c{1}] [%X{user} %X{ip} %X{userAgent}] - %m%n); PropertyConfigurator.configure(props); } App1 uses A.jar and B.jar from App2 in compilation and runtime. Both jars are placed in sar archive and deployed in default/deploy folder under Jboss. The other (App2) is RMI Server application deployed separately (it uses another log4j-1.2.8.jar placed in its classpath). A.jar and B.jar are in its classpath. App2 configures log4j by log4j properties file: log4j.category.CONSOLE = , aCONSOLE log4j.appender.aCONSOLE = org.apache.log4j.ConsoleAppender log4j.additivity.CONSOLE=false log4j.appender.aCONSOLE.ImmediateFlush=true log4j.appender.aCONSOLE.layout=org.apache.log4j.PatternLayout -- Both applications are physically on the same machine. The problem occurs when some class from App1 invokes a class from B.jar. Then logging disappears from console window of App1. No further message in log appears. However logging into file works OK. My question is: What can cause such behavior? Thanx for the hint in advance. Best regards Milan ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com - To unsubscribe, e-mail:
Re: log4j stops logging at console
Hello people, here is the scenario, which causes console logging to stop. Remote application (RMI server App), which is made by third party is started by batch file. Configuration file for log4j is found during startup and loggers are created, by using custom log4j.loggerFactory I entered some debug statements and saw that loggers are loaded with classLoader [EMAIL PROTECTED] Maybe it is important to tell you that there is used bad practice to have almighty class with many static properties, among which are the loggers. The second side of story is my client ear application under JBoss. Classes in my application depend on classes from RMI Server App, they need to have them in classpath in compile time. But in the runtime, classes from RMI server are not deployed anywhere else. Jboss is started with expanded JBOSS_CLASSPATH variable, changed in run.bat, containing paths to those classes. During startup, my MBean loaded by JBoss classloader [EMAIL PROTECTED] tries to connect to RMI Server and to obtain some remote class. But then above mentioned class on RMI Server side (containing constants and loggers as static members) is loaded again, this time with [EMAIL PROTECTED] Configuration file for log4j is parsed again and after PropertyConfigurator.configureAndWatch(s, 6L), I lose logging on Jboss CONSOLE, but logging to file remains. I hope, I gave you enough information. Any help, suggestion or hint would be more than welcome. Best regards Milan ___ Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j stops logging at console
JBoss, by current design, only provides for one logging context (ie LoggerRepository). On top of that, the JBoss log4j.xml also sets up a special CONSOLE appender that maps the System.out and System.err streams. If you do any kind of configuration after JBoss starts up that affects the console appender OR affects loggers that have been defined in the JBoss log4j.xml file, then it will affect the output to the log files. Especially Console, do not mess with Console. Also, if your log4j code ever calls LoggerRepository.shutdown() during a redeploy, then logging will be hosed as well. JBoss really needs to provide a better mechanism to allowing web apps and ejb's to do their own logging. Log4j does provide some layering of configuration where you can set up your own loggers and appenders as long as they are not references by the first/base configuration file. Or you can just add your logging stuff to the JBoss log4j.xml file directly. You may also find the following link useful, but I don't know if anyone has gotten to work correctly in JBoss or not. Seems to me that to be completely efficient, it would need to be supported pretty deep in the JBoss log4j initialization. http://www.qos.ch/logging/sc.jsp -Mark -Original Message- From: Clandes Tino [mailto:[EMAIL PROTECTED] Sent: Monday, May 16, 2005 6:51 AM To: log4j-user@logging.apache.org Subject: log4j stops logging at console Hello all. I am facing the problem with log4j usage in two separate applications. I am using CONSOLE appenders for both of them. Applications are started separately (in two shell windows). The first app (App1) is assembled as EAR and deployed under JBoss (it uses log4j.jar from JBoss/server/default/lib and initializes log4j through MBean, where appenders and loggers are configured). Here is the method in MBean that configures log4j in App1: --- private void initLog4j() throws ConfigurationException { final Properties props = new Properties(); props.setProperty(log4j.category.com.myapp, DEBUG, CONSOLE, FILE); props.setProperty(log4j.appender.CONSOLE,org.apache.log4j.ConsoleAppend er); props.setProperty(log4j.appender.CONSOLE.layout,org.apache.log4j.Patter nLayout) props.setProperty(log4j.appender.CONSOLE.layout.ConversionPattern,%d{IS O8601} %-5p [%c{1}] [%X{user}] - %m%n); props.setProperty(log4j.appender.FILE,org.apache.log4j.RollingFileAppen der); props.setProperty(log4j.appender.FILE.File, getConfigurationSetting(LOG_FILE)); props.setProperty(log4j.appender.FILE.MaxFileSize, getConfigurationSetting(MAX_FILE_SIZE)); props.setProperty(log4j.appender.FILE.MaxBackupIndex, getConfigurationSetting(MAX_BACKUP_FILE)); props.setProperty(log4j.appender.FILE.layout,org.apache.log4j.PatternLa yout); props.setProperty(log4j.appender.FILE.layout.ConversionPattern,%d{ISO86 01} %-5p [%c{1}] [%X{user} %X{ip} %X{userAgent}] - %m%n); PropertyConfigurator.configure(props); } App1 uses A.jar and B.jar from App2 in compilation and runtime. Both jars are placed in sar archive and deployed in default/deploy folder under Jboss. The other (App2) is RMI Server application deployed separately (it uses another log4j-1.2.8.jar placed in its classpath). A.jar and B.jar are in its classpath. App2 configures log4j by log4j properties file: log4j.category.CONSOLE = , aCONSOLE log4j.appender.aCONSOLE = org.apache.log4j.ConsoleAppender log4j.additivity.CONSOLE=false log4j.appender.aCONSOLE.ImmediateFlush=true log4j.appender.aCONSOLE.layout=org.apache.log4j.PatternLayout -- Both applications are physically on the same machine. The problem occurs when some class from App1 invokes a class from B.jar. Then logging disappears from console window of App1. No further message in log appears. However logging into file works OK. My question is: What can cause such behavior? Thanx for the hint in advance. Best regards Milan ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.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: log4j stops logging at console
The thing that confused me was that it seemed like he was saying that there were two physically separate instances of JBoss being started up. That is, each in their own JVM. If that were the case, then this issue would be a bit perplexing. If it is all, ultimately running under a single JBoss instance, then your explanation makes sense. I wouldn't say that JBoss needs internal rework to get application-separated logging working, though. If the repository selector hasn't already been set, it can be set once by any application. If it has, then JBoss already has the concept in mind, and they must provide some sort of hook-in to be able to configure the repository selector. Jake At 09:38 AM 5/16/2005 -0700, you wrote: JBoss, by current design, only provides for one logging context (ie LoggerRepository). On top of that, the JBoss log4j.xml also sets up a special CONSOLE appender that maps the System.out and System.err streams. If you do any kind of configuration after JBoss starts up that affects the console appender OR affects loggers that have been defined in the JBoss log4j.xml file, then it will affect the output to the log files. Especially Console, do not mess with Console. Also, if your log4j code ever calls LoggerRepository.shutdown() during a redeploy, then logging will be hosed as well. JBoss really needs to provide a better mechanism to allowing web apps and ejb's to do their own logging. Log4j does provide some layering of configuration where you can set up your own loggers and appenders as long as they are not references by the first/base configuration file. Or you can just add your logging stuff to the JBoss log4j.xml file directly. You may also find the following link useful, but I don't know if anyone has gotten to work correctly in JBoss or not. Seems to me that to be completely efficient, it would need to be supported pretty deep in the JBoss log4j initialization. http://www.qos.ch/logging/sc.jsp -Mark -Original Message- From: Clandes Tino [mailto:[EMAIL PROTECTED] Sent: Monday, May 16, 2005 6:51 AM To: log4j-user@logging.apache.org Subject: log4j stops logging at console Hello all. I am facing the problem with log4j usage in two separate applications. I am using CONSOLE appenders for both of them. Applications are started separately (in two shell windows). The first app (App1) is assembled as EAR and deployed under JBoss (it uses log4j.jar from JBoss/server/default/lib and initializes log4j through MBean, where appenders and loggers are configured). Here is the method in MBean that configures log4j in App1: --- private void initLog4j() throws ConfigurationException { final Properties props = new Properties(); props.setProperty(log4j.category.com.myapp, DEBUG, CONSOLE, FILE); props.setProperty(log4j.appender.CONSOLE,org.apache.log4j.ConsoleAppend er); props.setProperty(log4j.appender.CONSOLE.layout,org.apache.log4j.Patter nLayout) props.setProperty(log4j.appender.CONSOLE.layout.ConversionPattern,%d{IS O8601} %-5p [%c{1}] [%X{user}] - %m%n); props.setProperty(log4j.appender.FILE,org.apache.log4j.RollingFileAppen der); props.setProperty(log4j.appender.FILE.File, getConfigurationSetting(LOG_FILE)); props.setProperty(log4j.appender.FILE.MaxFileSize, getConfigurationSetting(MAX_FILE_SIZE)); props.setProperty(log4j.appender.FILE.MaxBackupIndex, getConfigurationSetting(MAX_BACKUP_FILE)); props.setProperty(log4j.appender.FILE.layout,org.apache.log4j.PatternLa yout); props.setProperty(log4j.appender.FILE.layout.ConversionPattern,%d{ISO86 01} %-5p [%c{1}] [%X{user} %X{ip} %X{userAgent}] - %m%n); PropertyConfigurator.configure(props); } App1 uses A.jar and B.jar from App2 in compilation and runtime. Both jars are placed in sar archive and deployed in default/deploy folder under Jboss. The other (App2) is RMI Server application deployed separately (it uses another log4j-1.2.8.jar placed in its classpath). A.jar and B.jar are in its classpath. App2 configures log4j by log4j properties file: log4j.category.CONSOLE = , aCONSOLE log4j.appender.aCONSOLE = org.apache.log4j.ConsoleAppender log4j.additivity.CONSOLE=false log4j.appender.aCONSOLE.ImmediateFlush=true log4j.appender.aCONSOLE.layout=org.apache.log4j.PatternLayout -- Both applications are physically on the same machine. The problem occurs when some class from App1 invokes a class from B.jar. Then logging disappears from console window of App1. No further message in log appears. However logging into file works OK. My question is: What can cause such behavior? Thanx for the hint in advance. Best regards Milan ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo!
RE: log4j stops logging at console
Quoting Mark Womack [EMAIL PROTECTED]: Yeah, but you are playing roulette with determining which application installs the respository selector and assuming they are all trying to install the same one. It really should be better supported at the container level. Have you gotten the JNDI context selector to work in JBoss? I tried some time ago and had problems, but did not have a chance to follow up in detail. Support at the container level would be nice. My point is that even if JBoss doesn't feel like supporting it, it is pretty easy to make it happen yourself without JBoss' support. If one controls the server to a certain degree, the whole roulette analogy fades away. Sometimes it is hard to get a project that big to listen to you in a timely manner. In any case, the only support we'd need at the container level would be setting a system property. Assuming the ContextJNDISelector works under JBoss, it would be very simple for someone to add the extra -D param to JBoss' startup script. I don't know why it wouldn't work? It works under Tomcat and weblogic. Should work in JBoss. Jake -Mark -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, May 16, 2005 8:32 PM To: Log4J Users List Subject: RE: log4j stops logging at console The thing that confused me was that it seemed like he was saying that there were two physically separate instances of JBoss being started up. That is, each in their own JVM. If that were the case, then this issue would be a bit perplexing. If it is all, ultimately running under a single JBoss instance, then your explanation makes sense. I wouldn't say that JBoss needs internal rework to get application-separated logging working, though. If the repository selector hasn't already been set, it can be set once by any application. If it has, then JBoss already has the concept in mind, and they must provide some sort of hook-in to be able to configure the repository selector. Jake At 09:38 AM 5/16/2005 -0700, you wrote: JBoss, by current design, only provides for one logging context (ie LoggerRepository). On top of that, the JBoss log4j.xml also sets up a special CONSOLE appender that maps the System.out and System.err streams. If you do any kind of configuration after JBoss starts up that affects the console appender OR affects loggers that have been defined in the JBoss log4j.xml file, then it will affect the output to the log files. Especially Console, do not mess with Console. Also, if your log4j code ever calls LoggerRepository.shutdown() during a redeploy, then logging will be hosed as well. JBoss really needs to provide a better mechanism to allowing web apps and ejb's to do their own logging. Log4j does provide some layering of configuration where you can set up your own loggers and appenders as long as they are not references by the first/base configuration file. Or you can just add your logging stuff to the JBoss log4j.xml file directly. You may also find the following link useful, but I don't know if anyone has gotten to work correctly in JBoss or not. Seems to me that to be completely efficient, it would need to be supported pretty deep in the JBoss log4j initialization. http://www.qos.ch/logging/sc.jsp -Mark -Original Message- From: Clandes Tino [mailto:[EMAIL PROTECTED] Sent: Monday, May 16, 2005 6:51 AM To: log4j-user@logging.apache.org Subject: log4j stops logging at console Hello all. I am facing the problem with log4j usage in two separate applications. I am using CONSOLE appenders for both of them. Applications are started separately (in two shell windows). The first app (App1) is assembled as EAR and deployed under JBoss (it uses log4j.jar from JBoss/server/default/lib and initializes log4j through MBean, where appenders and loggers are configured). Here is the method in MBean that configures log4j in App1: --- private void initLog4j() throws ConfigurationException { final Properties props = new Properties(); props.setProperty(log4j.category.com.myapp, DEBUG, CONSOLE, FILE); props.setProperty(log4j.appender.CONSOLE,org.apache.log4j.ConsoleAppend er); props.setProperty(log4j.appender.CONSOLE.layout,org.apache.log4j.Patter nLayout) props.setProperty(log4j.appender.CONSOLE.layout.ConversionPattern,%d{IS O8601} %-5p [%c{1}] [%X{user}] - %m%n); props.setProperty(log4j.appender.FILE,org.apache.log4j.RollingFileAppen der); props.setProperty(log4j.appender.FILE.File, getConfigurationSetting(LOG_FILE)); props.setProperty(log4j.appender.FILE.MaxFileSize, getConfigurationSetting(MAX_FILE_SIZE
Re: log4j stops logging at console
On May 16, 2005, at 8:50 AM, Clandes Tino wrote: Hello all. I am facing the problem with log4j usage in two separate applications. I am using CONSOLE appenders for both of them. Applications are started separately (in two shell windows). The first app (App1) is assembled as EAR and deployed under JBoss (it uses log4j.jar from JBoss/server/default/lib and initializes log4j through MBean, where appenders and loggers are configured). Could you see if the problem occurs with the CVS HEAD? It might be an instance of bug 31056 (http://issues.apache.org/bugzilla/ show_bug.cgi?id=31056) which was recently addressed. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j stops logging at console
JBoss, by current design, only provides for one logging context (ie LoggerRepository). On top of that, the JBoss log4j.xml also sets up a special CONSOLE appender that maps the System.out and System.err streams. If you do any kind of configuration after JBoss starts up that affects the console appender OR affects loggers that have been defined in the JBoss log4j.xml file, then it will affect the output to the log files. Especially Console, do not mess with Console. Also, if your log4j code ever calls LoggerRepository.shutdown() during a redeploy, then logging will be hosed as well. JBoss really needs to provide a better mechanism to allowing web apps and ejb's to do their own logging. Log4j does provide some layering of configuration where you can set up your own loggers and appenders as long as they are not references by the first/base configuration file. Or you can just add your logging stuff to the JBoss log4j.xml file directly. You may also find the following link useful, but I don't know if anyone has gotten to work correctly in JBoss or not. Seems to me that to be completely efficient, it would need to be supported pretty deep in the JBoss log4j initialization. http://www.qos.ch/logging/sc.jsp -Mark -Original Message- From: Clandes Tino [mailto:[EMAIL PROTECTED] Sent: Monday, May 16, 2005 6:51 AM To: log4j-user@logging.apache.org Subject: log4j stops logging at console Hello all. I am facing the problem with log4j usage in two separate applications. I am using CONSOLE appenders for both of them. Applications are started separately (in two shell windows). The first app (App1) is assembled as EAR and deployed under JBoss (it uses log4j.jar from JBoss/server/default/lib and initializes log4j through MBean, where appenders and loggers are configured). Here is the method in MBean that configures log4j in App1: --- private void initLog4j() throws ConfigurationException { final Properties props = new Properties(); props.setProperty(log4j.category.com.myapp, DEBUG, CONSOLE, FILE); props.setProperty(log4j.appender.CONSOLE,org.apache.log4j.ConsoleAppend er); props.setProperty(log4j.appender.CONSOLE.layout,org.apache.log4j.Patter nLayout) props.setProperty(log4j.appender.CONSOLE.layout.ConversionPattern,%d{IS O8601} %-5p [%c{1}] [%X{user}] - %m%n); props.setProperty(log4j.appender.FILE,org.apache.log4j.RollingFileAppen der); props.setProperty(log4j.appender.FILE.File, getConfigurationSetting(LOG_FILE)); props.setProperty(log4j.appender.FILE.MaxFileSize, getConfigurationSetting(MAX_FILE_SIZE)); props.setProperty(log4j.appender.FILE.MaxBackupIndex, getConfigurationSetting(MAX_BACKUP_FILE)); props.setProperty(log4j.appender.FILE.layout,org.apache.log4j.PatternLa yout); props.setProperty(log4j.appender.FILE.layout.ConversionPattern,%d{ISO86 01} %-5p [%c{1}] [%X{user} %X{ip} %X{userAgent}] - %m%n); PropertyConfigurator.configure(props); } App1 uses A.jar and B.jar from App2 in compilation and runtime. Both jars are placed in sar archive and deployed in default/deploy folder under Jboss. The other (App2) is RMI Server application deployed separately (it uses another log4j-1.2.8.jar placed in its classpath). A.jar and B.jar are in its classpath. App2 configures log4j by log4j properties file: log4j.category.CONSOLE = , aCONSOLE log4j.appender.aCONSOLE = org.apache.log4j.ConsoleAppender log4j.additivity.CONSOLE=false log4j.appender.aCONSOLE.ImmediateFlush=true log4j.appender.aCONSOLE.layout=org.apache.log4j.PatternLayout -- Both applications are physically on the same machine. The problem occurs when some class from App1 invokes a class from B.jar. Then logging disappears from console window of App1. No further message in log appears. However logging into file works OK. My question is: What can cause such behavior? Thanx for the hint in advance. Best regards Milan ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.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]