RE: JMSQueueAppender and Tomcat 4.1
Howdy, Make sure your initial context factory implementation is in WEB-INF/lib, and that you construct an initial context with the environment parameter (hashtable), not just new InitialContext(). In that environment, specify the factory class name and server JNDI URL. When you don't, you're using tomcat's default JNDI initial context factory implementation which can't talk to your IBM server. If you do the above, you'll be able to run with the Sun JDK (or any other). I suggest you read the JNDI documentation. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sabitha [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 6:58 PM To: [EMAIL PROTECTED] Subject: JMSQueueAppender and Tomcat 4.1 I am using the JMSQueueAppender (from the contributions) in a webapp that is deployed on Tomcat 4.1 using Sun's jdk 1.4. When I try to write to this appender, I get the following exception: log4j:ERROR Could not get initial context with [com.ibm.websphere.naming.WsnInitialContextFactory] and [iiop://linudia3:2011]. log4j:ERROR Error while activating options for appender named [JMSPTOP]. javax.naming.ServiceUnavailableException: NULL returned when resolving initial reference=NameService From researching on the web, I found out that I may have to use IBM's JDK to get this to work. And sure enough when I change Tomcat settings to use the IBM JDK , it works. Does anyone know if there is a workaround for this because the we need to use the Sun jdk? Thanks..Sabitha - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Selective Logging
Howdy, Yes, there is: add a LevelMatchFilter set to ERROR to your appender. My apologies for reading your original request as ERROR or higher rather than simply ERROR. It's an unusual configuration -- why would you want to NOT log fatal errors? Yoav Shapira Millennium ChemInformatics -Original Message- From: Sudhakar G [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 9:07 AM To: Log4J Users List Subject: RE: Selective Logging Hi, Thanks for the reply.But setting the threshold to ERROR will log both ERROR and FATAL right.I am eager to know is there any possible setting in config file will avoid writing fatal messages too.. Sudhakar -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 7:31 PM To: Log4J Users List Subject: RE: Selective Logging Howdy, 1)I want to log only error level messages in log file.How do I proceed? Yes, define a FileAppender with Threshold of ERROR. 2)Is it possible to change the configuration setting at runtime without restarting the server it should reflect while logging? Yes, both programmatically and automatically by changing the log file. See Configurator#configureAndWatch, the log4j config servlet in the log4j sandbox repository, and this list's archive. 3)Is it possible application running in different port should log to a same log file? Yes. Basically, RTFM ;) Start out by reading the short manual and adding log4j to your application. Then, when you run into specific problems ask us and we'll help. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JMSQueueAppender and Tomcat 4.1
Howdy, And the class with the initial context factory implementation (com.ibm...) is in your WEB-INF/lib? Along with log4j? Yoav Shapira Millennium ChemInformatics -Original Message- From: Sabitha [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 9:50 AM To: Log4J Users List Subject: RE: JMSQueueAppender and Tomcat 4.1 Thank you for the response. I am constructing the initial context factory as you suggest - using the hastable. Both this and the provider URL are specified in the log4j file for the JMSQueueAppender. ht.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); ht.put(Context.PROVIDER_URL, providerUrl); return (new InitialContext(ht)); Here is my log4j config: appender name=JMSPTOP class=appenders.JMSQueueAppender param name=InitialContextFactory value=com.ibm.websphere.naming.WsnInitialContextFactory / param name=ProviderUrl value=iiop://linudia3:2011 / param name=QueueConnectionFactoryBindingName value=QCF_YBR/ param name=QueueBindingName value=YBR_Activity_Q5/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%m/ /layout /appender I have included the IBM jars in my Web-inf/lib directory. Sabitha Shapira, Yoav [EMAIL PROTECTED] wrote: Howdy, Make sure your initial context factory implementation is in WEB-INF/lib, and that you construct an initial context with the environment parameter (hashtable), not just new InitialContext(). In that environment, specify the factory class name and server JNDI URL. When you don't, you're using tomcat's default JNDI initial context factory implementation which can't talk to your IBM server. If you do the above, you'll be able to run with the Sun JDK (or any other). I suggest you read the JNDI documentation. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sabitha [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 6:58 PM To: [EMAIL PROTECTED] Subject: JMSQueueAppender and Tomcat 4.1 I am using the JMSQueueAppender (from the contributions) in a webapp that is deployed on Tomcat 4.1 using Sun's jdk 1.4. When I try to write to this appender, I get the following exception: log4j:ERROR Could not get initial context with [com.ibm.websphere.naming.WsnInitialContextFactory] and [iiop://linudia3:2011]. log4j:ERROR Error while activating options for appender named [JMSPTOP]. javax.naming.ServiceUnavailableException: NULL returned when resolving initial reference=NameService From researching on the web, I found out that I may have to use IBM's JDK to get this to work. And sure enough when I change Tomcat settings to use the IBM JDK , it works. Does anyone know if there is a workaround for this because the we need to use the Sun jdk? Thanks..Sabitha - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JMSQueueAppender and Tomcat 4.1
Howdy, My guess is you're missing a class required by the IBM InitialContextFactory implementation. Did you include the whole websphere.jar? If so, what's in that jar? Yoav Shapira Millennium ChemInformatics -Original Message- From: Sabitha [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 11:17 AM To: Log4J Users List Subject: RE: JMSQueueAppender and Tomcat 4.1 Yes.. this class is in the websphere.jar file and I have included it - along with log4j-1.2.8.jar - in my WEB-INF/lib directory. Sabitha Shapira, Yoav [EMAIL PROTECTED] wrote: Howdy, And the class with the initial context factory implementation (com.ibm...) is in your WEB-INF/lib? Along with log4j? Yoav Shapira Millennium ChemInformatics -Original Message- From: Sabitha [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 9:50 AM To: Log4J Users List Subject: RE: JMSQueueAppender and Tomcat 4.1 Thank you for the response. I am constructing the initial context factory as you suggest - using the hastable. Both this and the provider URL are specified in the log4j file for the JMSQueueAppender. ht.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); ht.put(Context.PROVIDER_URL, providerUrl); return (new InitialContext(ht)); Here is my log4j config: value=com.ibm.websphere.naming.WsnInitialContextFactory / I have included the IBM jars in my Web-inf/lib directory. Sabitha Shapira, Yoav wrote: Howdy, Make sure your initial context factory implementation is in WEB-INF/lib, and that you construct an initial context with the environment parameter (hashtable), not just new InitialContext(). In that environment, specify the factory class name and server JNDI URL. When you don't, you're using tomcat's default JNDI initial context factory implementation which can't talk to your IBM server. If you do the above, you'll be able to run with the Sun JDK (or any other). I suggest you read the JNDI documentation. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sabitha [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 6:58 PM To: [EMAIL PROTECTED] Subject: JMSQueueAppender and Tomcat 4.1 I am using the JMSQueueAppender (from the contributions) in a webapp that is deployed on Tomcat 4.1 using Sun's jdk 1.4. When I try to write to this appender, I get the following exception: log4j:ERROR Could not get initial context with [com.ibm.websphere.naming.WsnInitialContextFactory] and [iiop://linudia3:2011]. log4j:ERROR Error while activating options for appender named [JMSPTOP]. javax.naming.ServiceUnavailableException: NULL returned when resolving initial reference=NameService From researching on the web, I found out that I may have to use IBM's JDK to get this to work. And sure enough when I change Tomcat settings to use the IBM JDK , it works. Does anyone know if there is a workaround for this because the we need to use the Sun jdk? Thanks..Sabitha - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you
RE: Log output path problem
Howdy, You need to specify the absolute path or use an environment variable, such as one set to the server's home. Your current specification is relative to the current working directory of the server, which varies depending on how the server is invoked. Yoav Shapira Millennium ChemInformatics -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 12:40 PM To: [EMAIL PROTECTED] Subject: Log output path problem Hi, I want my log output to go to /WEB-INF/logs/ as specified in my log4j.properties --- - log4j.rootLogger=debug, stdout, ROOT_APPENDER log4j.appender.ROOT_APPENDER=org.apache.log4j.DailyRollingFileAppender log4j.appender.ROOT_APPENDER.DatePattern='.'-MM-dd log4j.appender.ROOT_APPENDER.File=WEB-INF/logs/debug.log --- - But I am getting the following error when I run a test program: --- - log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: WEB-INF\logs\debug.log (The system cannot find the path specified) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.init(FileOutputStream.java:174) at java.io.FileOutputStream.init(FileOutputStream.java:102) at org.apache.log4j.FileAppender.setFile(FileAppender.java:272) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151) at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingF ileA ppend er.java:206) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:247 ) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.jav a:12 3) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.jav a:87 ) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurato r.ja va:64 5) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurato r.ja va:60 3) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyCon figu rator .java:500) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator. java :406) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator. java :432) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConve rter .java :460) at org.apache.log4j.LogManager.clinit(LogManager.java:113) at org.apache.log4j.Logger.getLogger(Logger.java:94) at Log4JTest.clinit(Log4JTest.java:21) log4j:ERROR Either File or DatePattern options are not set for appender [ROOT_APPENDER]. INFO [main] (Log4JTest.java:29) - Entering application. 0 [main] INFO Log4JTest - Entering application. program executing INFO [main] (Log4JTest.java:31) - Exiting application. 0 [main] INFO Log4JTest - Exiting application. --- - The test program is: --- import org.apache.log4j.Logger; import org.apache.log4j.BasicConfigurator; public class Log4JTest { // Define a static logger variable so that it references the // Logger instance named Log4JTest. static Logger logger = Logger.getLogger(Log4JTest.class); public static void main(String[] args) { // Set up a simple configuration that logs on the console. BasicConfigurator.configure(); logger.info(Entering application.); System.out.println(program executing); logger.info(Exiting application.); } } --- PS. I don'tget the above error if I specify the output path to be: log4j.appender.ROOT_APPENDER.File=debug.log Oh, I aslo tried: log4j.appender.ROOT_APPENDER.File=/WEB-INF/logs/debug.log But got same error. Thanks in advance! -Yan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log output path problem
Howdy, You're asking a number of questions in this one post. This is weird. I had it working two hours ago with /web/WEB- INF/logs/debug.log as my output path. Now it's not working!!! I have to use the absolute path The above is an absolute path. It should work (provided you have permission to write to this directory). make logging working for now. Also it seems that if I use the relative path /web/debug.log or just debug.log, things worke fine, but that's not where I want it to go to. I didn't say it wouldn't work: I said it would place the log file in a path relative to the current working directory of the server. As you've observed, this is not the desired behavior. Could the same server invoke things differently? Man, what's the deal with Depends on the server. More likely, you started the server from different directories. setFile() anyway? Why it cannot create the path dirs if the path doesn't exist? That's beyond the purview of log4j. The user is responsible for configuration including the creation of directories. It is both common and recommended to run Java with a security manager with specific write permissions to the log file only, not anywhere else. Yoav Shapira -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 10:44 AM To: Log4J Users List Subject: RE: Log output path problem Howdy, You need to specify the absolute path or use an environment variable, such as one set to the server's home. Your current specification is relative to the current working directory of the server, which varies depending on how the server is invoked. Yoav Shapira Millennium ChemInformatics -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 12:40 PM To: [EMAIL PROTECTED] Subject: Log output path problem Hi, I want my log output to go to /WEB-INF/logs/ as specified in my log4j.properties -- - - log4j.rootLogger=debug, stdout, ROOT_APPENDER log4j.appender.ROOT_APPENDER=org.apache.log4j.DailyRollingFileAppender log4j.appender.ROOT_APPENDER.DatePattern='.'-MM-dd log4j.appender.ROOT_APPENDER.File=WEB-INF/logs/debug.log -- - - But I am getting the following error when I run a test program: -- - - log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: WEB-INF\logs\debug.log (The system cannot find the path specified) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.init(FileOutputStream.java:174) at java.io.FileOutputStream.init(FileOutputStream.java:102) at org.apache.log4j.FileAppender.setFile(FileAppender.java:272) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151) at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRolling F ileA ppend er.java:206) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:24 7 ) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.ja v a:12 3) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.ja v a:87 ) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurat o r.ja va:64 5) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurat o r.ja va:60 3) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyCo n figu rator .java:500) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator . java :406) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator . java :432) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConv e rter .java :460) at org.apache.log4j.LogManager.clinit(LogManager.java:113) at org.apache.log4j.Logger.getLogger(Logger.java:94) at Log4JTest.clinit(Log4JTest.java:21) log4j:ERROR Either File or DatePattern options are not set for appender [ROOT_APPENDER]. INFO [main] (Log4JTest.java:29) - Entering application. 0 [main] INFO Log4JTest - Entering application. program executing INFO [main] (Log4JTest.java:31) - Exiting application. 0 [main] INFO Log4JTest - Exiting application. -- - - The test program is: --- import org.apache.log4j.Logger; import org.apache.log4j.BasicConfigurator; public class Log4JTest { // Define a static logger variable so that it references the // Logger instance named Log4JTest. static Logger logger = Logger.getLogger(Log4JTest.class); public static void main(String[] args) { // Set up a simple configuration that logs on the console. BasicConfigurator.configure
RE: Log4j SMTP Appender Tomcat trouble
Howdy, You do know the SMTP appender by default will only send our ERROR and higher messages, right? Yoav Shapira Millennium ChemInformatics -Original Message- From: Jardin Xavier [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 10:06 AM To: Log4J Users List Subject: Re: Log4j SMTP Appender Tomcat trouble I have removed from WEB-INF/lib the mail.jar, you're right it was already in CATALINA_HOME\common\lib but this modification has no effect. Log4j is configured using a properties file pass to the PropertyConfigurator.configure(.) method. The file is located in the Tomcat CATALINA_HOME\conf folder and all the different logger give me an output except the mail logger. The additivity of the mail logger is true so I have the message on the console but no mail under TomCat. Xavier. - Original Message - From: Jacob Kjome [EMAIL PROTECTED] To: Log4J Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 2:42 PM Subject: Re: Log4j SMTP Appender Tomcat trouble mail.jar shouldn't be in WEB-INF/lib as it is an endorsed library (anything java.* javax.*, org.xml.*, org.w3c.dom.*). Put it in CATALINA_HOME/common/lib or endorsed. This allows Tomcat to use the mail api as well as your apps and will avoid troubles when/if the JDK actually includes the mail api (does the J2EE jar include it?). Of course, this probably isn't your immediate problem. Is Log4j getting configured under Tomcat for you? That is, are you getting output in other appenders? If not, get that going first, and then try to get the Mail appender working. Where is log4j.properties? WEB-INF/classes? Are you configuring it manually? It may have been in the classpath of your IDE, but not of your webapp. Just things to check out. Jake At 02:00 PM 12/3/2003 +0100, you wrote: Hello, I'm trying to use the SMTP Appender of log4j 1.2.8 with the following configuration : ### Logger Mail ( SMTP Appender ) log4j.logger.Mail=DEBUG, Mail log4j.appender.Mail=org.apache.log4j.net.SMTPAppender log4j.appender.Mail.BufferSize=4096 log4j.appender.Mail.From=zz [EMAIL PROTECTED] log4j.appender.Mail.Subject= log4j.appender.Mail.SMTPHost=zz..zzz log4j.appender.Mail.layout=org.apache.log4j.SimpleLayout log4j.appender.Mail.layout=org.apache.log4j.PatternLayout log4j.appender.Mail.layout.ConversionPattern=%d[%c{1}i %x] %m%n under Eclipse using a simple test class I receive the mail. When I try to do the same under Tomcat 4.1.29 / JDK 1.4 nothing append : no mail, no dump. I use the same mail.jar ( the jar is in WEB-INF/lib for Tomcat ) on both test case. Please advise, Regards, Jardin Xavier. - 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] - 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 SMTP Appender Tomcat trouble
Howdy, Thanks for the correction Ceki ;) Xavier, you can set the SMTP appender threshold as you need, or provide an alternative TriggeringEventEvaluator. Yoav Shapira Millennium ChemInformatics -Original Message- From: Jardin Xavier [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 10:22 AM To: Log4J Users List Subject: Re: Log4j SMTP Appender Tomcat trouble Thanks you're right I have sent an error message and this unlock all the other messages sent to the mail appender with a low level priority. Does it mean that even you put a debug level to the SMTP appender you have to send an error message to collect and send all the message previously log on it with a low level priority ? Xavier. - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Log4J Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 4:07 PM Subject: RE: Log4j SMTP Appender Tomcat trouble Howdy, You do know the SMTP appender by default will only send our ERROR and higher messages, right? Yoav Shapira Millennium ChemInformatics -Original Message- From: Jardin Xavier [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 10:06 AM To: Log4J Users List Subject: Re: Log4j SMTP Appender Tomcat trouble I have removed from WEB-INF/lib the mail.jar, you're right it was already in CATALINA_HOME\common\lib but this modification has no effect. Log4j is configured using a properties file pass to the PropertyConfigurator.configure(.) method. The file is located in the Tomcat CATALINA_HOME\conf folder and all the different logger give me an output except the mail logger. The additivity of the mail logger is true so I have the message on the console but no mail under TomCat. Xavier. - Original Message - From: Jacob Kjome [EMAIL PROTECTED] To: Log4J Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 2:42 PM Subject: Re: Log4j SMTP Appender Tomcat trouble mail.jar shouldn't be in WEB-INF/lib as it is an endorsed library (anything java.* javax.*, org.xml.*, org.w3c.dom.*). Put it in CATALINA_HOME/common/lib or endorsed. This allows Tomcat to use the mail api as well as your apps and will avoid troubles when/if the JDK actually includes the mail api (does the J2EE jar include it?). Of course, this probably isn't your immediate problem. Is Log4j getting configured under Tomcat for you? That is, are you getting output in other appenders? If not, get that going first, and then try to get the Mail appender working. Where is log4j.properties? WEB-INF/classes? Are you configuring it manually? It may have been in the classpath of your IDE, but not of your webapp. Just things to check out. Jake At 02:00 PM 12/3/2003 +0100, you wrote: Hello, I'm trying to use the SMTP Appender of log4j 1.2.8 with the following configuration : ### Logger Mail ( SMTP Appender ) log4j.logger.Mail=DEBUG, Mail log4j.appender.Mail=org.apache.log4j.net.SMTPAppender log4j.appender.Mail.BufferSize=4096 log4j.appender.Mail.From=zz [EMAIL PROTECTED] log4j.appender.Mail.Subject= log4j.appender.Mail.SMTPHost=zz..zzz log4j.appender.Mail.layout=org.apache.log4j.SimpleLayout log4j.appender.Mail.layout=org.apache.log4j.PatternLayout log4j.appender.Mail.layout.ConversionPattern=%d[%c{1}i %x] %m%n under Eclipse using a simple test class I receive the mail. When I try to do the same under Tomcat 4.1.29 / JDK 1.4 nothing append : no mail, no dump. I use the same mail.jar ( the jar is in WEB-INF/lib for Tomcat ) on both test case. Please advise, Regards, Jardin Xavier. - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL
RE: TelnetAppender generates NullPointerException
Hi, Let's stop the cross-posting to keep it on this (user, not dev) list. Looks like a bug. We probably need to look at TelnetAppender's shutdown or finalize method to make sure the socket is properly dismissed. I've never actually touched this appender's code. Please file this in bugzilla. Thanks, Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 1:47 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: TelnetAppender generates NullPointerException Hello, Thanks for responding so quickly. Though it's not included in the copy of my log4j.properties file I pasted into the beginning of this email thread, I did set the port with this line: log4j.appender.telnet.port=23 It made no difference. Actually, the problem appears to be that, when Tomcat reloads the web application after I run a build, TelnetAppender throws a BindException, with the message that the Address [is] already in use. Perhaps TelnetAppender is failing to dispose of its socket connection properly. If I shutdown and restart Tomcat, TelnetAppender works fine until the next time I reload the webapp, even without explicitly setting the port. If you like, I'll log a bug for this. Cheers, David P.S. Here's the stacktrace java.net.BindException: Address already in use: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331) at java.net.ServerSocket.bind(ServerSocket.java:318) at java.net.ServerSocket.init(ServerSocket.java:185) at java.net.ServerSocket.init(ServerSocket.java:97) at org.apache.log4j.net.TelnetAppender$SocketHandler.init(TelnetAppender .jav a :172) at org.apache.log4j.net.TelnetAppender.activateOptions(TelnetAppender.java :62) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:247 ) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.jav a:12 3 ) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.jav a:87 ) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurato r.ja v a:645) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurato r.ja v a:603) at org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyCon figu r ator.java:524) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator. java : 408) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator. java : 432) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConve rter . java:460) at org.apache.log4j.LogManager.clinit(LogManager.java:113) at org.apache.log4j.Logger.getLogger(Logger.java:85) at com.wellsfargo.marketsmart.util.AuditFilter.clinit(AuditFilter.java:2 1) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor Acce s sorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon stru c torAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at java.lang.Class.newInstance0(Class.java:308) at java.lang.Class.newInstance(Class.java:261) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationF ilte r Config.java:253) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(Applicati onFi l terConfig.java:327) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilt erCo n fig.java:120) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.ja va:3 1 60) at org.apache.catalina.core.StandardContext.reload(StandardContext.java:25 41) at org.apache.catalina.loader.WebappLoader$WebappContextNotifier.run(Webap pLoa d er.java:1369) at java.lang.Thread.run(Thread.java:534) -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 9:53 AM To: Log4J Developers List Subject: RE: TelnetAppender generates NullPointerException Howdy, Did you do as the bug report suggests and set the port explicitly even though the docs say that's not required? Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 12:44 PM To: [EMAIL PROTECTED] Subject: FW: TelnetAppender generates NullPointerException Sorry for emailing the dev list directly, but I could use some help with the TelnetAppender. It throws a NullPointer exception when I try to use it, and as far as I can tell I'm not doing anything unusual with it. This is for Log4J v. 1.2.8, running in Tomcat 4.1. It could be this bugnot sure: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15198 Regards, David
RE: Concurrency and performance degradation
Howdy, There is anyway to improve the performance in a concurrency environment (maybe defining a buffer size and have only one thread writing to the file and to the console? ) and prevent this concurrency problems? If, instead of having the logger for each class as a static variable, if i have a Logger instance for each instance of each class (as an instance variable), the performance is improved? No, keep one instance per class. Consider using the AsyncAppender or writing a buffered appender like the SMTPAppender. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Concurrency and performance degradation
Howdy, I don't know, I haven't used it, as I haven't found the need for it. What I do in high-load environment is surround INFO and DEBUG level statements with is-enabled checks (Logger.isDebugEnabled() etc.), which reduces their overhead by nearly 100%. I don't have INFO and DEBUG enabled in production, so I don't suffer from high load at all. Yoav Shapira Millennium ChemInformatics -Original Message- From: Campos Rui Oliveira [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 11:57 AM To: Log4J Users List Subject: RE: Concurrency and performance degradation Hi. Thanks for the reply. What are the implications of using an AsyncAppender? With AsyncAppender don't i have an high probability of get a confused log with lines cutted at half by other lines that are being added? Rui Campos -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 21 November 2003 16:37 To: Log4J Users List Subject: RE: Concurrency and performance degradation Howdy, There is anyway to improve the performance in a concurrency environment (maybe defining a buffer size and have only one thread writing to the file and to the console? ) and prevent this concurrency problems? If, instead of having the logger for each class as a static variable, if i have a Logger instance for each instance of each class (as an instance variable), the performance is improved? No, keep one instance per class. Consider using the AsyncAppender or writing a buffered appender like the SMTPAppender. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Concurrency and performance degradation
Howdy Firstly, log4j already has a FAQ, and moreover it's wiki so you can put your money where your mouth is. Secondly, I don't think this is technically a FAQ as it's asked very rarely (about once in six months I think). Yoav Shapira Millennium ChemInformatics -Original Message- From: Horst Scheruga [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 12:53 PM To: [EMAIL PROTECTED] Subject: Re: Concurrency and performance degradation Date: Fri, 21 Nov 2003 18:48:31 +0100 (MET) From: Horst Scheruga [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Concurrency and performance degradation This problem seems very common to me. Costs me 2 days to figure out the trivial and obviousliy reason in my case. I your question I found that you are using a console appender. First remove it and look at the performance again. (Best done by setting the threshold of the appender to WARN or ERROR) If your problem still exists then sorry, I cannot help you. For me the problem was to have the console appender activly logging everything and accessing the Server via a remote tool (VNC). I think LOG4J should have a FAQ and one common question would be Why takes my log-statement so long to execute? The problem I described should be one point of the answer to this question. regards Horst Scheruga -- NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien... Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService Jetzt kostenlos anmelden unter http://www.gmx.net +++ GMX - die erste Adresse für Mail, Message, More! +++ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SMTP log4j question
Howdy, You need to access the SMTPAppender object and call its methods to dynamically change the properties like the subject line. How are you configuring log4j? If you know the name of the SMTPAppender, e.g. EmailAppender this is pretty easy. In your class, you would do something like: Logger rootLogger = Logger.getRootLogger(); SMTPAppender email = (SMTPAppender) rootLogger.getAppender(EmailAppender); email.setSubject(New subject line); email.setTo([EMAIL PROTECTED]); email.activateOptions(); If you don't know the name of the appender, or don't want to hard-code it, you can still do this. Use Logger.getAllAppenders() to get all the appenders, then iterate through them checking for appender instanceof SMTPAppender. A couple of notes since you mentioned you're new to this: 1. By default the SMTP appender will send out ERROR and higher messages only. If you want it to send INFO or lower, you will need to change its Threshold. Alternatively, you can write a custom TriggeringEventEvaluator for the appender to use. 2. If you have a small number of possible subject lines and to addresses, consider creating one SMTP appender for each combination. Yoav Shapira Millennium ChemInformatics -Original Message- From: Miller,Catherine [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 7:07 AM To: '[EMAIL PROTECTED]' Subject: SMTP log4j question I'll start by letting everyone one know I am very new to Java (though I've been in IT for 10yrs) and log4j so please excuse if this is a stupid question. I have been able to set up a test application using log4j to send email to myself as a test for sending some logging information. The next step I need to take is to be able to dynamicly change the to address and the subject on the fly based on what information is to be sent. Part of what we email are integration error messages and these are sent based on what system encountered an error. Our old setup was to use a MQSeries queue to hold lists of who got what email type(s). The old system is also written in Object Rexx. Once it was determined who got the message we used Blat to send a SMTP message from a central mailing application. If anyone can help it would be greatly appriciated. Thanks in advance :) Cat Miller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SMTP log4j question
Howdy, Don't use the same name for a logger as you do for an appender: log4j is fine with it but it's confusing to humans. In the code I sent you I assumed your SMTP appender is attached to the root logger. In the configuration below, it's not, so the SMTPsetup variable is null. You can either attach it to the root logger and use my code, or use SMTPAppender SMTPsetup = (SMTPAppender) Logger.getLogger(SMTP).getAppender(SMTP); Yoav Shapira Millennium ChemInformatics -Original Message- From: Miller,Catherine [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 9:02 AM To: 'Log4J Users List' Subject: RE: SMTP log4j question Here is a snippet of my properties file. I actually set up many files so I only included the root and SMTP appender. # This configuration illustrates filtering by logger name. log4j.debug=false log4j.rootLogger=DEBUG, ROOT log4j.appender.ROOT=org.apache.log4j.FileAppender log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout log4j.appender.ROOT.File=D:/data/home/nqt1/logs/rms/test.log log4j.appender.ROOT.layout.ConversionPattern=[%t] %-5p %c - %m%n #configuring the SMTP appender log4j.logger.SMTP=DEBUG, SMTP log4j.additivity.SMTP=false log4j.appender.SMTP.EvaluatorClass=org.oclc.cmnappl.SendMail log4j.appender.SMTP=org.apache.log4j.net.SMTPAppender log4j.appender.SMTP.SMTPHost=mailhost.oclc.org [EMAIL PROTECTED] log4j.appender.SMTP.subject=Testing the appender [EMAIL PROTECTED] log4j.appender.SMTP.layout.LocationInfo=false log4j.appender.SMTP.layout=org.oclc.cmnappl.HTMLCustom log4j.appender.SMTP.layout.Title=OPOrder Performance Statistics I tried your sample but got a NullPointerException. Here is what I coded based on my properties file. Please let me know if I just screw up coding it. Logger rootLogger = Logger.getRootLogger(); SMTPAppender SMTPsetup = (SMTPAppender) rootLogger.getAppender(SMTP); SMTPsetup.setSubject(New subject line); SMTPsetup.setTo([EMAIL PROTECTED]); SMTPsetup.activateOptions(); Thanks for your help :) Cat -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 8:50 AM To: Log4J Users List Subject: RE: SMTP log4j question Howdy, You need to access the SMTPAppender object and call its methods to dynamically change the properties like the subject line. How are you configuring log4j? If you know the name of the SMTPAppender, e.g. EmailAppender this is pretty easy. In your class, you would do something like: Logger rootLogger = Logger.getRootLogger(); SMTPAppender email = (SMTPAppender) rootLogger.getAppender(EmailAppender); email.setSubject(New subject line); email.setTo([EMAIL PROTECTED]); email.activateOptions(); If you don't know the name of the appender, or don't want to hard-code it, you can still do this. Use Logger.getAllAppenders() to get all the appenders, then iterate through them checking for appender instanceof SMTPAppender. A couple of notes since you mentioned you're new to this: 1. By default the SMTP appender will send out ERROR and higher messages only. If you want it to send INFO or lower, you will need to change its Threshold. Alternatively, you can write a custom TriggeringEventEvaluator for the appender to use. 2. If you have a small number of possible subject lines and to addresses, consider creating one SMTP appender for each combination. Yoav Shapira Millennium ChemInformatics -Original Message- From: Miller,Catherine [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 7:07 AM To: '[EMAIL PROTECTED]' Subject: SMTP log4j question I'll start by letting everyone one know I am very new to Java (though I've been in IT for 10yrs) and log4j so please excuse if this is a stupid question. I have been able to set up a test application using log4j to send email to myself as a test for sending some logging information. The next step I need to take is to be able to dynamicly change the to address and the subject on the fly based on what information is to be sent. Part of what we email are integration error messages and these are sent based on what system encountered an error. Our old setup was to use a MQSeries queue to hold lists of who got what email type(s). The old system is also written in Object Rexx. Once it was determined who got the message we used Blat to send a SMTP message from a central mailing application. If anyone can help it would be greatly appriciated. Thanks in advance :) Cat Miller - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you
RE: log4j.properties in a jar file
Howdy, By doing jar cvf [jarFileName] log2j.properties ;) It's not difficult. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sahraei Sasan-ssahra01 [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 10:04 AM To: 'Log4J Users List' Subject: log4j.properties in a jar file Hi, How is it possible to put log2j.properties in a jar file? Thanks, Sasan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j.properties in a jar file
Howdy, You mean for auto-configuration of log4j? In general, if you put a resource in a jar file it's accessible to the ClassLoader#getResource call, which is what log4j uses to auto-configure itself. You have to make sure the log4j.properties file is at the top level of the jar, so getResource(/log4j.properties) will work. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sahraei Sasan-ssahra01 [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 10:18 AM To: 'Log4J Users List' Subject: RE: log4j.properties in a jar file :) thanks :), the question was, is it possible though to include the properties file into a jar file, will be accessble then by log4j loaders (those classes that are required to read it)? -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 17 November 2003 15:14 To: Log4J Users List Subject: RE: log4j.properties in a jar file Howdy, By doing jar cvf [jarFileName] log2j.properties ;) It's not difficult. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sahraei Sasan-ssahra01 [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 10:04 AM To: 'Log4J Users List' Subject: log4j.properties in a jar file Hi, How is it possible to put log2j.properties in a jar file? Thanks, Sasan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to use env vars in log4j.properties file
Howdy, I guess you're assuming log4j automatically reads environment properties into an env. prefix scheme like Ant? ;) Try just environment variable, e.g. $CATALINA_HOME or ${CATALINA_HOME}. Yoav Shapira Millennium ChemInformatics -Original Message- From: Praveen Alavilli [mailto:[EMAIL PROTECTED] Sent: Friday, November 14, 2003 2:22 PM To: Log4J Users List Subject: how to use env vars in log4j.properties file Hi, I am trying to configure a DailyRollingFileAppender for my test app. I want to set the log file to be in my server's (tomcat) log dir along with other log files. But if set the File path as log4j.appender.MyappLog.File=${env.CATALINA_HOME}/logs/myapp.log it throws this error: log4j: setFile called: /logs/myapp.log, true log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /logs/myapp.log (No such file or directory) Is there any ther way to get this working apart from hard coding the file name/dir ? thanks in advance Praveen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ms sql server and log4j problems
Howdy, Can you rerun your system with -Dlog4j.debug=true as a java runtime option, and tell us what you're logging in the logger.error(???) statement? Yoav Shapira Millennium ChemInformatics -Original Message- From: Magnus Andersson [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 9:55 AM To: Log4J Users List Subject: ms sql server and log4j problems i got a problem with my database and log4j. I found a correct driver that connect to database but i got a error message that says: log4j:ERROR Failed to excute sql java.sql.SQLException: [MAGNUS]Line 1: Incorrect syntax near 'ERROR'. at com.inet.tds.a.a(Unknown Source) at com.inet.tds.g.if(Unknown Source) at com.inet.tds.g.executeUpdate(Unknown Source) at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:163) at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:235) at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:131) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders (AppenderAttachableImpl.java:57) at org.apache.log4j.Category.callAppenders(Category.java:187) at org.apache.log4j.Category.forcedLog(Category.java:372) at org.apache.log4j.Category.error(Category.java:286) at GetMail.main(GetMail.java:76) and that 'ERROR' is in the java code the first log message it says logger.error(logging started); This is the config file: log4j.rootLogger=DEBUG, ROOT #log4j.appender.ROOT.Driver=sun.jdbc.odbc.JdbcOdbcDriver log4j.appender.ROOT=org.apache.log4j.jdbc.JDBCAppender log4j.appender.ROOT.Driver=com.inet.tds.TdsDriver log4j.appender.ROOT.URL=jdbc:inetdae7:MAGNUS:1433?database=Log4j_db log4j.appender.ROOT.user=sa log4j.appender.ROOT.password=sa log4j.appender.ROOT.sql=INSERT INTO JDBCTEST (Date, Priority, Logger, Method, Message) VALUES ('%d{- MMM-dd HH:mm:ss,SSS}' '%-5.5p' '%C' '%M' '%m\r\n') log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout PLEASE what is wrong??? Vad står det om dig på nätet? - http://www.lycos.se/ This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: automatic reload
Howdy, A decent place to stop and start such threads in a servlet container would be the ServletContextListener. There is no static destructor, but you have Runtime#addShutdownHook which is suitable for this purpose as well. Create a little Runnable class with a reference to the Watchdog thread, add your Runnable as a shutdown hook, the JVM will run it (once) on shutdown, and your Runnable should interrupt the log4j Watchdog thread. This approach is good outside servlet containers as well. Yoav Shapira Millennium ChemInformatics -Original Message- From: Tom Eugelink [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 1:45 PM To: Log4J Users List Subject: Re: automatic reload Hey Mark, Well, I could always try to make time (time suddenly is a rare commodity once you furthered yourself in the human genepool, at least for the next 6 years or so). What I see as a problem is not so much the automatic starting of a thread, but when to stop it. In a stand alone application this is not such a problem, but in a container, where you have a separate configuration for each context (webapp0, I can't imagine where to hook that in, in a generic fashion. Starting could be done in the static constructor of a class, which is loaded by the classloader of the context, but AFAIK there is no static destructor. How does the plugin logic start and stop plugins? Tom Mark Womack wrote: Tom, In v1.3 Watchdogs will be a subclass of Plugin. Plugins are new to v1.3 and configurable from (at least xml) configuration files. So, you'll be able to define watchdogs in the configuration files. Plugins have some code to not stop/recreate running plugins during reconfiguration, so eventually if a watchdog is watching the configuration file that defines it, it will be maintained across reconfigurations, etc. Still working out some of those details. Actually the Watchdog code I released way-back-when still needs to be checked into cvs and worked into the plugin infrastructure. If you have any comments, ideas, or time to review (once I get it checked in) I'd love to hear them. thanks, -Mark -Original Message- From: Tom Eugelink [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 6:06 AM To: Log4J Users List Subject: Re: automatic reload I see (took a look at the sources that were included in the older mail). Basically he has rewritten the AndWatch part, expanding it into a semi-framework, and adding a method to stop the thread (stopWatching). Basically one could write a servlet that starts a watchdog upon load and stops it upon finalize. It still isn't done totally external of the application via configuration, but I can see how that can be a problem. I'll ponder a bit more. Thank you! Tom Jacob Kjome wrote: look at configureAndWatch() in the configurators. However, I wouldn't use this in a container as the thread will run until the JVM is shut down. There is no manual way to stop it. Look for Mark Womack's watchdogs in the next version of Log4j for a better solution. Here's an old message with some actual code showing how it works. Check the latest CVS, though, as things have probably changed... http://marc.theaimsgroup.com/?l=log4j-userm=101656353725142w=2 Jake At 01:52 PM 11/9/2003 +0100, you wrote: I know there is a parameter which can be used to specifiy that log4j must reload a configuration file (checking every so often). But I prefer autoconfiguration. AFAIK it is not possible to set autoreload from a configuration file, correct? Tom - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: caching...
Howdy, Look at the cyclic buffer used by the SMTP appender. It does what you want. You can modify another appender to use it as well. Yoav Shapira Millennium ChemInformatics -Original Message- From: Alan Brown [mailto:[EMAIL PROTECTED] Sent: Monday, November 10, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: caching... I'd like to only log debugging messages if a warning or error occurs shortly afterwards. In the past I've written my own logging systems that have cached messages and then logged the last x debug messages to file if an error occurs. Is there a way to do this with Log4J or would I have to write my own caching mechanism in front of the logger? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with logging separation between webapps and container
Howdy, I'm using Resin Servlet Container. I have developed librairies(jar files) that are shared by many web applications, I have put my libraries jar in the global classpath of the servlet container. You problem pretty much starts and ends here. Disk space is cheap: have each app's jars in its own WEB-INF/lib directory. Don't use the server's global classpath for your apps. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j losing log files
Howdy, Neither in the JSPs nor the servlet: take Jacob's advice about the ServletContextListener, it's a good one. Yoav Shapira Millennium ChemInformatics -Original Message- From: Laurent Blume [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 12:36 PM To: Log4J Users List Subject: Re: log4j losing log files Jacob Kjome wrote: Are you calling LogManager.shutdown() at application shutdown? If not, try that, otherwise, the file will probably remain locked by the VM. Do this in a servlet context listener contextDestroyed() method. No, I'm not, and it's a good idea. But I'm unsure if it's possible to do that: all my JSPs are called through a servlet which handles the sessions, and I don't have the source of that servlet. Or would it be correct to do it in the JSPs themselves? Laurent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: filter some class to one file, different class to another file
Howdy, True. But this is trivial, is in many of the free examples, and in the archives of this list. log4j.appender.f1=org.apache.log4j.FileAppender log4j.appender.f1.File=file1.txt log4j.appender.f1.Layout=org.apache.log4j.TTCCLayout log4j.appender.f1.additivity=false log4j.appender.f2=org.apache.log4j.FileAppender log4j.appender.f2.File=file2.txt log4j.appender.f2.Layout=org.apache.log4j.TTCCLayout log4j.appender.f2.additivity=false log4j.logger.com.mycompany.package1=DEBUG,f1 log4j.logger.com.mycompany.packagr2=DEBUG,f2 log4j.rootLogger=DEBUG Or something like that... Yoav Shapira Millennium ChemInformatics -Original Message- From: Charles Hudak [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 4:38 PM To: 'Log4J Users List' Subject: RE: filter some class to one file, different class to another file Support Ceki and buy the manual. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 13:37 To: [EMAIL PROTECTED] Subject: filter some class to one file, different class to another file Hello, I'm new to configuring my log4j.xml file, and have been searching the log4j-user mail archives for something relevant... please help! I would like my appender to write to a file, such that only certain java packages get written out, others get written to a different file. For example, I want every log message from any package com.nokia.nes.ans and any package in the heirarchy below it. I do NOT want stuff from org.jboss or com.nokia.somethingelse written to this log file. How would I configure this in the log4j.xml file? Thanks, Gretel - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j losing log files
Howdy, I don't have a solution to your problem, just a couple of points/questions. ;) The log4j1.2.8.jar file is in each webapp/WEB-INF/lib. Each webapp has its own config file in webapp/WEB-INF/classes. Good. Each config file contains: log4j.rootLogger=DEBUG log4j.logger.dev=DEBUG, dev log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n log4j.appender.dev=org.apache.log4j.RollingFileAppender log4j.appender.dev.File=C:/logs/dev_01.log log4j.appender.dev.layout=org.apache.log4j.PatternLayout log4j.appender.dev.layout.ConversionPattern=%d %X{RemoteHost} %C %-5p %c - %m%n log4j.appender.dev.MaxFileSize=1000KB log4j.appender.dev.MaxBackupIndex=100 Why define the stdout appender if you don't use it? Try removing it. I haven't used the straight rolling file appender much. I mostly use the DailyRollingFileAppender and haven't had a problem with it. Perhaps you could give this a shot (again, as you say you've done it in the past) and see what happens. That way, I can get such a list of files as: .log .log.10 .log.11 .log.12 .log.13 .log.14 .log.15 .log.16 .log.17 .log.18 .log.19 .log.20 .log.49 .log.50 .log.51 .log.52 .log.53 I simply don't have any idea about what is going on. I spend a lot of Add -Dlog4j.debug=true to your JAVA_OPTS when launching tomcats. Log4j will then output internal debugging information to $CATALINA_HOME/logs/catalina.out. Perhaps that will tell you something useful, especially when you see the output generated when log4j is rolling files over. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J vs. java.util.logging
Howdy, This is true -- in fact it grew out of a classloader discovery type mechanism into more of a wrapper ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 8:42 AM To: Log4J Users List Subject: RE: Log4J vs. java.util.logging Unless I am mistaken, commons-logging was always dynamic. It always used classloader tricks to determine which logging API to use. At 02:26 PM 10/27/2003 +0100, Tbee wrote: If I read the commons-logging articles correctly, this is exactly how commons- logging came to be. A wrapper grown dynamic. Tom Quoting Lutz Michael [EMAIL PROTECTED]: One additional quick thought: someone mentioned using Commons Logging to switch back and forth between JDK logging, Log4j, and potentially other logging solutions. If one wraps Log4j as recommended by Ceki's book using Decorator (GoF), one realizes a similar effect. The wrapper class could even load a particular logging solution at run-time based on system configuration. I get the impression that in general Ceki recommends wrapping Log4j. Note that he strongly recommends against sub-classing Logger, which is often a developer's first direction. Decorator is recommended, although I don't think an interface for Logger exists as such so one must emulate the Log4j interface if so desired. An organization could also of course choose more of an Adapter approach, and make the interface whatever they prefer, potentially shooting for backward compatibility with a logging solution already in existence in the enterprise. This approach mitigates the risk of being tied to a particular solution, while not incurring the potential pains of Commons Logging. Mike -Original Message- From: Tbee [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 3:59 AM To: Log4J Users List Subject: RE: Log4J vs. java.util.logging Admittedly, many of us at here at log4j-user@ are biased in favor of log4j. Really? Naah. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - - - This message and any included attachments are from Siemens Medical Solutions USA, Inc. and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to [EMAIL PROTECTED] Thank you - 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] -- Ceki Gülcü For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp import org.apache.Facetime; ApacheCon US 2003, 18-21 November http://apachecon.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J vs. java.util.logging
Howdy, http://www.qos.ch/logging/thinkAgain.html http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/Log4jvsJDKLogging http://builder.com.com/5100-22-1046694.html Log4j will be around. The next major release, v1.3, is going to have several great new features to further distance log4j from JDK 1.4 logging. Use log4j. Yoav Shapira Millennium ChemInformatics -Original Message- From: Matthias Petersen [mailto:[EMAIL PROTECTED] Sent: Friday, October 24, 2003 10:15 AM To: [EMAIL PROTECTED] Subject: Log4J vs. java.util.logging Hi, I saw in the 1.4 JDK that there were new classes introduced concerning logging, which seems to be a base for Log4J. When I take a look at the class hierarchy of Log4J, it is not a subclass of those JDK logging classes (I think the reason is that Log4J is older than the 1.4 JDK...). So, what will happen with Log4J in the future ? Will it be a subclass of the Java 1.4 logging classes or will it go in a different direction ? I think that the Log4J classes are much better than the 1.4 Java classes, but what will happen if those Java classes will become the standard for logging ? Or will Log4J be a part of the JDK somewhere in the future ? Your answers are very important for me, because I have to decide if my company is using Log4J or if we need to enhance the 1.4 JDK logging classes. Thanks Matthias -- Matthias Petersen ms management systems gmbh Krokamp 29 24539 Neumünster Fon: +49. 4321. 9995-49 Fax: +49. 4321. 9995-41 E-Mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J vs. java.util.logging
Howdy, http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/Log4jvs JDKL ogging I modified and edited the above page. Please let me know what you think. I took a look -- I like it ;) I corrected a couple of small text errors. I would like to add a link to the phrase that says log4j performs well under heavy loads, with, well, a proof of that phrase ;) Maybe the org.apache.log4j.performance javadoc is what we want to link to here? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log file permissions issue unix
Howdy, Not a log4j issue: this is controlled by the umask setting for the user running the JVM. Yoav Shapira Millennium ChemInformatics -Original Message- From: Scott Burns [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 9:10 AM To: [EMAIL PROTECTED] Subject: log file permissions issue unix How can I configure log4j to set the permissions for a new file? When a new log file is created it does so without group write permissions. (-rw-r-r- instead of -rw-rw-r-). This causes a problem for the log files shared between multiple account processes. Any suggestions on how to do this? I am offsite and do not have my manual with me. Thanks in advance Scott -rw-r--r-- 1 bfapp webadm 1379 Oct 22 23:31 wrapper.log This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log file permissions issue unix
Howdy, Log4j doesn't (and can't, even if it wanted to) set umask for the user. What I would is write a little unix script to invoke your application, but before invoking it do umask -S to verify the umask settings. The 02 your sysadmin set up is good. Since you're logging in as user tomcat, I assume you're running tomcat. Tomcat also doesn't (and cat) set umask for the user. I just checked, by the way, and I have the same behavior as you ;) Solaris 9, JDK 1.4.2, umask 02, log4j 1.2.8 on tomcat 4.1.27, and the log file is created as -rw-r--r--. Strange, I don't have an answer. Yoav Shapira Millennium ChemInformatics -Original Message- From: Scott Burns [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 11:40 AM To: Log4J Users List Subject: RE: log file permissions issue unix Yoav, thanks for reply. Any thoughts on this comment? Scott Yes, umasks would normally be where to look. However, I have made efforts to standardize umasks on all of our servers to open group permissions. For example, if you log in on 02 as tomcat, you'll see your umask is: umask -S u=rwx,g=rwx,o=rx Same for all other accounts. I have also set the system default for all user accounts that way. So, unless the program or script explicitly sets a umask without group write, all files created would have group write permissions. That's why I asked about log4j. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 9:12 AM To: Log4J Users List Subject: RE: log file permissions issue unix Howdy, Not a log4j issue: this is controlled by the umask setting for the user running the JVM. Yoav Shapira Millennium ChemInformatics -Original Message- From: Scott Burns [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 9:10 AM To: [EMAIL PROTECTED] Subject: log file permissions issue unix How can I configure log4j to set the permissions for a new file? When a new log file is created it does so without group write permissions. (-rw-r-r- instead of -rw-rw-r-). This causes a problem for the log files shared between multiple account processes. Any suggestions on how to do this? I am offsite and do not have my manual with me. Thanks in advance Scott -rw-r--r-- 1 bfapp webadm 1379 Oct 22 23:31 wrapper.log This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log level definitions
Howdy, Did you mean this thread? http://marc.theaimsgroup.com/?l=log4j-userm=105189448809301w=2 Yoav Shapira Millennium ChemInformatics -Original Message- From: Dennis Cook [mailto:[EMAIL PROTECTED] Sent: Sunday, October 19, 2003 4:05 PM To: [EMAIL PROTECTED] Subject: Log level definitions A little while back someone posted some definitions of the type of information, for which the various logging levels should be used. I thought it quite good and would like to share it with some coworkers, but I cannot locate it. I am asking for a repost of that information. thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Useful Object Renderers
Howdy, I'm wondering whether there are any useful object renderers that I haven't heard about, hopefully downloadable and easily integratable. Things I'd be looking to output without having to have long debugging logic in my code would be beans, JDBC ResultSet rows, and so on. Looking around the log4j codebase all I can see is one jms and one sax renderers, both rather basic. I'm sure people have done these for their own projects: they're not tough. They would be a nice contribution to the log4j sandbox for starters, maybe to be integrated into the core later on. It seems to me that this would be a very useful feature, improving the I prefer toString() methods that print all the information about the Object. Then I just call logger.debug(myObject) (which calls myObject.toString() down the line automatically) without writing or configuring any ObjectRenderers. But that's just me. However, there's the case where the object you want to log is not yours, e.g. java.sql.ResultSet, and if it doesn't have a good toString() method an ObjectRenderer would be perfect. In any case, I think the inclusion of more useful standard Object Renderers into the log4j codebase would be a very good thing for log4j, and I'm wondering why this hasn't been done yet. Are there any reasons that I'm not aware of? The usual reason: no one cares enough to contribute it? ;) I'm sure many have written their own. An ObjectRenderer to display your two cases: a Bean and a java.sql.ResultSet, wouldn't be that hard. They might have a couple of catches: the bean one would use reflection and probably wouldn't display information that can't be obtained via public methods (often one also wants private/protected field values displayed). The ResultSet one would have to be careful about resetting the ResultSet to its original condition when it's done rendering. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Useful Object Renderers
Howdy, I've written initial versions of both (ResultSetRenderer and BeanRenderer). I've submitted them to Bugzilla as enhancement request, because my WinCVS is not working here at work. I'll commit them into the sandbox (unless someone wants them elsewhere), hopefully tonight. Feel free to comment on them, add features, etc: Bugzilla issues 23945, 23946. Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, October 20, 2003 10:54 AM To: [EMAIL PROTECTED] Subject: RE: Useful Object Renderers Hi Ceki, Re: BeanWrapper I find the BeanWrapper the most useful, because it does not require the developer to add anything to the bean. That decreases the overhead of writing the logging code. In exchange, it increases the overhead of running it.. Having very low overhead for adding logging code is very useful for me because I find myself working on other people's code a lot these days, and having to debug obscure problems with that code, I have been using log4j extensively to be able to follow what's going on. When adding log statements to large amounts of other people's code, the quicker it happens the best it is, in my experience.. Also when writing new code, you are more likely to add a log statement if it is a minor typing overhead (not to mention maintenance overhead) than not. I think the best solution might be to offer both possibilities, with the advice that if you are using the BeanWrapper, you should surround your log statement with an if (log.isDebugEnabled()) just like for string concatenation. On the other hand, if your bean implements LoggableBean you don't need to. I think that would give the best of both worlds, so when you're writing new code and you've got enough time you tag your beans as LoggableBeans, and when you're hastily adding log statements to someone else's code you can do so at the expense of an if() check with just a BeanWrapper. For the rendering of it, I think the idea when outputting a bean's fields to the log would be to show as much data as is available (within reason). Showing all available public bean properties, and maybe truncating the ones which are too long, would be the way I would expect such a renderer to work. Maybe this could be configurable from the log4j config file (log4j.renderer.bean.truncateLength?) Re: Generic ObjectRenderers Yes, I think so. It encourages more logging, which I think is a good thing, and removes logging display logic code. In an ideal world, log4j would become so closely integrated with java that much code (such as log.debug(entering);) would be automatically generated by the compiler or the VM! However until hell freezes over, the closest we can get is to make it really easy for people to write log statements and decrease maintenance time. If I have time I'll probably write a few generic object renderers when I'm home. The resultset one, for instance... most useful. Daniel PS: Btw, I've been meaning to say, thank you for writing log4j. I don't think I'd stand a ghost of a chance of finishing this project on time if it wasn't for log4j and the ease and flexibility with which I've been able to insert it all over the place to figure out what this code was doing (and be able to turn the debugging on and off at will). So thanks a lot for making this available :-) -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: 20 October 2003 15:11 To: Log4J Users List Subject: Re: Useful Object Renderers Hi Daniel, Comments below. At 11:55 AM 10/20/2003 +0100, [EMAIL PROTECTED] wrote: Hi all, I'm wondering whether there are any useful object renderers that I haven't heard about, hopefully downloadable and easily integratable. Things I'd be looking to output without having to have long debugging logic in my code would be beans, JDBC ResultSet rows, and so on. Looking around the log4j codebase all I can see is one jms and one sax renderers, both rather basic. It seems to me that this would be a very useful feature, improving the quality of usage practice with log4j. Just like layout patterns which allow you to log the locational information and avoid keeping such information in the log messages themselves (and thus having to maintain log messages such as log.debug(entering xyz.foo()) - much better as log.debug(entering)), standard object renderers reduce the complexity of the logging code. For instance, when wanting to output the contents of a bean, it would be nice to be able to just type: log.debug(myBean); Given the way object renderers work, that is of course not possible since beans are not subclasses of a particular class. One way to get around that would be for the logger to recognize an org.apache.log4j.BeanWrapper class so that this could be called like: log.debug(new BeanWrapper(myBean)); Creating a BeanWrapper for each bean to be logged is certainly one way to mark a bean for object rendering. There are other ways which can
RE: Making HTML log file available through web app
Howdy, I thought about this servlet reading approach, but didn't post it because I wasn't sure it's possible to skirt the issue of loading a large log file into server memory before streaming it into the browser. It's a good interesting idea nonetheless. Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 3:53 AM To: [EMAIL PROTECTED] Subject: RE: Making HTML log file available through web app Agreed. One way you could get around this is by making a (fairly simple) servlet that finds out where the log4j log file is, reads it and displays it, on request. Should not be too hard, and will be more app-server-independent and administrator-independent than any attempt to write the log file directly to the web-root. Daniel -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 16 October 2003 23:27 To: Log4J Users List Subject: RE: Making HTML log file available through web app Howdy, Even if deploy exploded (a feature servlet containers are not required to support), the server admin may configure the server such that you don't have write access under your webapp. The only directory you're guaranteed write access to by the servlet specification is javax.servlet.context.tempdir, which the container may clean on shutdown, so you don't want to put your logs there. Deciding where logs go is a server administrator decision: leave it up to he/she by allowing them to configure something easily in web.xml or better yet, a server configuration entry you pick up via an env-entry in your web.xml file. Yoav Shapira Millennium ChemInformatics -Original Message- From: Doubleday, Dennis [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 6:07 PM To: 'Log4J Users List' Subject: RE: Making HTML log file available through web app No, different servers for different customers. Yes, OK, I suppose I can have a different log4j.xml for each app server and a server-specific Ant deployment target. What should the relative file location be, though, if I deploy an EAR file to the server and there is no exploded context-relative directory to write the logs to? Will I have to deploy exploded in order for that to work? Is that server-dependent? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 5:57 PM To: [EMAIL PROTECTED] Subject: RE: Making HTML log file available through web app This isn't necessarily app-server independent, but you can probably can take advantage of variable substitution in the config file. Log4j can substitute system property values into the log4j config file using the Ant-like syntax (${system properties}), so if your app server puts deployment-specific information into system variables (Weblogic does), then you can use them. Is it really necessary to do it in a totally app-server independent manner? It's just a matter of changing the config file. Are you running a heterogenous set of J2EE servers? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments
RE: App-server independent log4j logging
Howdy, I am pretty sure that Tomcat and Jboss will run independantly in separate VM instances, and hence definately separate class loaders. This implies there will be two indepedant instances of Log4j running, and they will need to log to separate files. I'm not sure at all -- can you convince me? ;) Yoav Shapira -Original Message- From: Tom Eugelink [mailto:[EMAIL PROTECTED] Sent: 17 October 2003 06:32 To: Log4J Users List Subject: Re: App-server independent log4j logging JBoss uses Tomcat underneath and I'm confused about the output of log4j in Tomcat also (one of my previous emails three days ago where noone responded on). What is very useful is setting the log4j debugging on (-Dlog4j.debug=on). And if you search for using you might find that log4j is using multiple configuration files. Currently I'm trying to figure out if that is the case with my problem. Tom Jacob Kjome wrote: Try reading this and see if it helps out: http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppConta iner L ogging I'm not sure exactly the problem under JBoss, but they do seem to have the concept of a single classloader, which seems to cause grief for people who want to deploy their preferred versions of various libraries in WEB-INF/lib only to be overridden by the same library in JBoss itself. Is there someone out there that can explain why JBoss' behavior is a good thing Jake At 03:42 PM 10/16/2003 -0400, you wrote: I neglected to say that, if I move my logger and appender definitions into JBoss's log4j.xml, I DO get the expected files. My question is: how can I ADD new loggers and appenders from a separate config file to the hierarchy that JBoss has already established? -Original Message- From: Doubleday, Dennis [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 3:11 PM To: '[EMAIL PROTECTED]' Subject: App-server independent log4j logging My application needs to be deployable to both JBoss and Websphere (and possibly Weblogic in future). I am trying to use log4j in my app, but not having any success, even only with JBoss. Here's the deal--I want to include my own log4j.jar and log4j.xml in my WAR file. If the app server is using log4j itself, as JBoss does, my log4j.xml should only extend the configuration set up by JBoss. I don't want to add my Appenders to the JBoss log4j.xml, I want them in my WAR so it doesn't depend on the JBoss environment. Here is a snippet of what I am doing in my init servlet: String prefix = getServletContext().getRealPath(/); String filePath = prefix + fileName; System.out.println (Log4JConfigServlet - initializing log4j using file: + filePath); try { if (fileName.indexOf(xml) != -1) { DOMConfigurator.configure(filePath); } else { PropertyConfigurator.configure(filePath); } Logger log = Logger.getLogger(Log4JConfigServlet.class); if (log.isInfoEnabled()) { log.info(Log4j initilized.); } } catch (Exception e) { I see both the println and the initial INFO log message in the JBoss console log, but the two FILE appenders don't seem to be getting created--I see debug output from the initial JBoss configuration but there is no debug output when my config file is processed. (The full file is at the end of the message). This approach worked in JBoss 3.0.6 but it mysteriously stopped when I upgraded to JBoss 3.2.1. Here's my log4j.xml: log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true !-- = -- !-- Preserve messages in a local file -- !-- = -- !-- A size based file rolling appender -- appender name=FALCONFILE class=org.apache.log4j.RollingFileAppender param name=File value=Falcon.log/ param name=Append value=false/ param name=MaxFileSize value=500KB/ param name=MaxBackupIndex value=20/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p [%c{1}.%M] %m%n/ /layout /appender appender name=FALCONHTML class=org.apache.log4j.RollingFileAppender param name=File value=Falcon.html/ param name=Append value=false/ param name=MaxFileSize value=500KB/ param name=MaxBackupIndex value=20/ param name=threshold value=info/ layout class=org.apache.log4j.HTMLLayout/ /appender appender name=FALCONCONSOLE class=org.apache.log4j.ConsoleAppender param name=Target value=System.out/ layout class=org.apache.log4j.PatternLayout !-- The default pattern: Date Priority [Category] Message\n -- param name=ConversionPattern value=%-5p [%c{1}] %m%n/ /layout /appender !-- Falcon base logger -- logger name=com.vocollect level value=debug / appender-ref
RE: need functionality to truncate the tail of fields using PatternLa yout
Howdy, I'm assuming all I need to do is send mail to dev mailing list with the subject PATCH, or [PATCH], and then include in the message the three diff - c outputs? You could do that or open a Bugzilla enhancement and attach your diffs. Is this kind of functionality useful to others? Not to me personally, but who knows about the general populace? ;) Is this the approach I should be taking when proposing changes? Yup. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: need functionality to truncate the tail of fields using Patte rnLa yout
Howdy, Conversion words are in log4j 1.3, which has not yet been released. Although an Alpha is not far away... Yoav Shapira Millennium ChemInformatics -Original Message- From: Lethin, Doug [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 11:58 AM To: Log4J Users List Subject: RE: need functionality to truncate the tail of fields using Patte rnLa yout Wow, thanks for the fast response from the man himself. I'm a bit baffled, though, as I thought what I had was the latest release, version 1.2.8, which doesn't seem to have the enhancements you mention. I'm guessing this is because its in the currently cvs code which I would need to get, rather than get the released version? Thanks again. doug -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 11:45 AM To: Log4J Users List Subject: Re: need functionality to truncate the tail of fields using PatternLa yout Doug, There is no need to patch the files you mention. Actually, they don't even exist anymore. PatternLayout has been modified to accept new conversion words. See https://www.qos.ch/logging/PatternLayout.html for more details. I hope this helps, At 11:24 AM 10/16/2003 -0400, Lethin, Doug wrote: [I sent this message the other day to the dev mailing list and got no response. I'm now sending this to the log4j user mailing list in case anyone has any feedback for me. Thanks in advance.] I'm migrating my application to use log4j and need to define a message format that's compatable with an output format already in place from my original logging code. There are two formats I can't currently seem to do: 1. I need to output the timestamp field as a two letter day of week string -- Mo, Tu, We, etc. 2. I need to output the priority field as one character - D, I, W, E, F It seems the formatting directives in PatternLayout don't allow for this. They allow you to truncate fields to a max value, but they're truncated from the front, such that the directive '%.1p will truncate INFO to 'O' and not 'I' I looked through the latest log4j code, and found a way to patch this functionality in by adding another formatting directive similar to the '.' but using a '#' instead. It will similarly define the max length for a field, BUT it will truncate the trailing characters rather than the leading characters. Examples: %d{E} - Tuesday %.2d{E} - ay (original truncate directive) %#2d{E} - Tu (new truncate directive) %p - INFO %.1p - O %#1p - I In order to do this, I needed to make minor patches to 3 files: - org.apache.log4j.helpers.FormattingInfo.java - org.apache.log4j.helpers.PatternConverter.java - org.apache.log4j.helpers.PatternParser.java I'd be happy to submit these patches in the hopes that this functionality could be added to the code base. I'm assuming all I need to do is send mail to dev mailing list with the subject PATCH, or [PATCH], and then include in the message the three diff -c outputs? Is this kind of functionality useful to others? Is this the approach I should be taking when proposing changes? Thanks in advance. Doug -- --- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp import org.apache.Facetime; ApacheCon US 2003, 18-21 November http://apachecon.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Making HTML log file available through web app
Howdy, Even if deploy exploded (a feature servlet containers are not required to support), the server admin may configure the server such that you don't have write access under your webapp. The only directory you're guaranteed write access to by the servlet specification is javax.servlet.context.tempdir, which the container may clean on shutdown, so you don't want to put your logs there. Deciding where logs go is a server administrator decision: leave it up to he/she by allowing them to configure something easily in web.xml or better yet, a server configuration entry you pick up via an env-entry in your web.xml file. Yoav Shapira Millennium ChemInformatics -Original Message- From: Doubleday, Dennis [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 6:07 PM To: 'Log4J Users List' Subject: RE: Making HTML log file available through web app No, different servers for different customers. Yes, OK, I suppose I can have a different log4j.xml for each app server and a server-specific Ant deployment target. What should the relative file location be, though, if I deploy an EAR file to the server and there is no exploded context-relative directory to write the logs to? Will I have to deploy exploded in order for that to work? Is that server-dependent? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 5:57 PM To: [EMAIL PROTECTED] Subject: RE: Making HTML log file available through web app This isn't necessarily app-server independent, but you can probably can take advantage of variable substitution in the config file. Log4j can substitute system property values into the log4j config file using the Ant-like syntax (${system properties}), so if your app server puts deployment-specific information into system variables (Weblogic does), then you can use them. Is it really necessary to do it in a totally app-server independent manner? It's just a matter of changing the config file. Are you running a heterogenous set of J2EE servers? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J 1.3 and/or sandbox
Hola, I have read a number of posts referring to version 1.3 and/or the log4-sandbox at Jakarta. I am eagerly awaiting the ConfigurationServlet and other new features, therefore the following questions: - Is there a schedule for when 1.3 is to be launched? (or am I being very optimistic, then...) When it's ready ;) Apache (and other open-source) products rarely have a schedule. At best you might get an approximation for when the beta will be out. Then there's testing, possibly more beta, before a release. - What TAG should I use when retrieving from the sandbox? Will Head work? Head, yes. You can start using many of the sandbox components, including the ConfigurationServlet, now. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Adding an abstraction level
Howdy, Not quite. Using isEnabledFor(Level l), e.g. isDebugEnabled() around logger.debug statements can significantly reduce logging overhead. You should read the log4j manual on this issue, as it contains a more complete explanation and benchmarks. As for your level of abstraction, which on this list we often refer to as a log4j wrapper: chances are you're not gaining much from it, but also not losing much in your case. I've seen worse wrappers suggested here, e.g. ones that do the Logger.getLogger(...) call each time -- that's terrible ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Jain, Siddharth (ODC - Satyam) [mailto:[EMAIL PROTECTED] Sent: Friday, October 03, 2003 2:23 AM To: Log4J Users List Subject: RE: Adding an abstraction level Hi Jitesh, I really do not think this would help you, since there is a property known as threshold in log4j, which specifies the minimum logging level, thereby, if you want that in certain deployment scenarios, or for certain appenders, messages should be logged above a certain level, then just specify this property to whatever level u want, because internally, log4j checks for the the level being enabled or not. I hope this helps you out. Cheers Siddharth -Original Message- From: Jitesh_Arya [mailto:[EMAIL PROTECTED] Sent: Friday, October 03, 2003 11:49 AM To: Log4J Users List Subject: Adding an abstraction level Hi, this is my first mail to this mailing list and it's not been long since I subscribed to it. So, please forgive if I sound really stupid putting forth my question(s). What we have done is we have added another level of abstraction between the application (some web app) developer and the log4j. We have written another class that imports log4j and other classes that are required for logging and written our own functions without any added functionality. That is, my debug will in turn call log4j's debug method. Another thing that has been added is: the isDebugEnabled () check before debug () of log4j is called. And similarly, isEnabledfor(level) for other levels. Now, my questions: 1) Is this added level of abstraction advisable? 2) Does the check before the call to log4j method serve any purpose (here in my case) in reducing the cost? This (in normal cases, not here) does prevent the cost of parameter construction when implemented in application directly (this I understand). But here, the parameters will be constructed, (so no savings on that side) when call is made to the debug () or any other method that we have implemented. So, you see anything here (diamond or just coal)? A heavy lot of thanks in ADVANCE:-) Regards, Jitesh This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: org.apache.log4j.DailyRollingFileAppender
Howdy, Yes. Search the archives. Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 03, 2003 3:00 PM To: [EMAIL PROTECTED] Subject: org.apache.log4j.DailyRollingFileAppender My java application running on AIX uses the DailyRollingFileAppender. Every so often, the roll-over does not occur at midnight, but later. Perhaps even a day later. Has anyone experienced this problem? Thanks! Clare H. Myers Application Developer Advisor Anthem - AMMS (513) 336-5472 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information or otherwise protected by law. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: org.apache.log4j.Logger
Howdy, Yes. The name is a unique identifier for a logger instance (within a loger repository). Logger.getLogger(com); Logger.getLogger(com.foo); Logger.getLogger(com.bar); All return different Logger instances. Yoav Shapira Millennium ChemInformatics -Original Message- From: Lummis, Patrick J [mailto:[EMAIL PROTECTED] Sent: Friday, October 03, 2003 3:08 PM To: [EMAIL PROTECTED] Subject: org.apache.log4j.Logger Hi, I'm trying to understand the hierarchy in log4j. If I do the following: Logger x = Logger.getLogger(com.apples) Logger y = Logger.getLogger(com.oranges) Will I get references to two distinct Logger objects? Patrick Lummis This message (including any attachments) may contain confidential information intended for a specific individual and purpose. If you are not the intended recipient, delete this message. If you are not the intended recipient, disclosing, copying, distributing, or taking any action based on this message is strictly prohibited. This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with HTMLLayout (log file attached)
Howdy, Chiming it late from the gallery -- you can take your log and try it in the HTML Validator (http://validator.w3.org/). Although that requires a DOCTYPE so you may have to add one manually to your HTML log file before validating. Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 11:48 AM To: Log4J Users List Subject: Re: Problem with HTMLLayout (log file attached) The file did not go through. The log4j-user mailing list filters out certain file types and has a size limit of 100KB. Maybe the table is not properly formatted? Look at the HTML file at the spot where things start to go wrong. At 07:56 AM 10/1/2003 -0700, Rajat Sharma wrote: Hi Sorry about that... The log files are 10MB each, so I'm attaching a part of the log file that shows the formatting problem. This problem is occuring in all of the log files (there are 5 separate logs being created). Could this occur due to the fact that I have set the Append value to 'true' and there's some problem when the application is restarted and the old log file is still there? I tried testing that on my box, but that doesn't seem to be the issue. This is seemingly happening at random, but I'm sure there's something I'm doing wrong! Thanks in advance for your help. Rajat. Ceki Gülcü [EMAIL PROTECTED] wrote: Can you include the resulting HTML file? Please do not send HTML-stylized text to this mailing lists. At 01:11 PM 9/30/2003 -0700, Rajat Sharma wrote: Hi I just put my application into testing and problems are pouring in... The latest one is with the HTMLLayout. In the middle of the log, the appender wrote this to the log file, and everything after this wasn't formatted in the display... (after some logging messages, it wrote some similar HTML to the log and the messages after that were formatted properly while displaying the log in IE). http://www.w3.org/TR/html4/loose.dtd; Log session start time Tue Sep 30 10:25:11 CDT 2003 Time Thread Level Category Message -- Ceki Gülcü For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp import org.apache.Facetime; ApacheCon US 2003, 18-21 November http://apachecon.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: bad days and good days
Howdy, I spent most of the day, going over the documentation on log4j and various ways of logging under Tomcat. Great article on commons-logging vs. Log4j :) I saw a reference to how different web-applications can have different log4j configurations in think again, but I am not sure where that is supposed to be described. I have yet to see any explanation of how that is supported. Simple: 1. Put log4j.jar in each webapp's WEB-INF/lib directory, and no where else. 2. Put log4j.properties in each webapp's WEB-INF/classes directory, and no where else. That's it. You can also doing it programmatically by writing an init servlet or servlet context listener that configure log4j. Then you can put the log4j.properties file anywhere under your webapp's root directory, and use ServletContext#getResourceAsStream(...) to get the file and feed it to PropertyConfigurator. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: getConfigurationFileName()
Howdy, If you used a classpath-discovery-based mechanism for configuring log4j, you can do this: http://javaalmanac.com/egs/java.lang/ClassOrigin.html?l=rel to figure out if it came from a jar and if so which jar. But that's a partial solution at best ;( Yoav Shapira Millennium ChemInformatics -Original Message- From: Henrik Vendelbo [mailto:[EMAIL PROTECTED] Sent: Saturday, September 27, 2003 9:31 PM To: [EMAIL PROTECTED] Subject: getConfigurationFileName() Is there a way that I can get the filename and absolute path for the file used to configure log4j. Once I am up and running, I would like to be able to check that I am indeed using the right configuration file. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Questions on initial log4j instance
Howdy, I hate to be such a nitpick on this, and it's a matter of style only not substance, but in case you care, things that are static final should be capitalized, so if you have a private static final Logger it should be private static final Logger LOGGER = Logger.getLogger(some.name); If you leave it as logger (lower case), obviously it still works fine but tools like Checkstyle complain. Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 11:41 AM To: Log4J Users List Subject: Re: Questions on initial log4j instance At 04:58 PM 9/29/2003 +0800, Yu Xiang Xi (Maveo) wrote: I have seen different usage of initial log4j instance like below private final static Logger logger = Logger.getLogger(some.name); looks good. and private final transient static Logger logger = Logger.getLogger(some.name); the second one has a additional keyword transient. Loggers cannot be serialized so marking them transient can be useful for non static loggers. However, since static variables are not serialized, there is no need to mark them as transient. Moreover, in addition to serialization aspects, the keyword 'transient' has other meanings. It forces the JVM to re-reread the value of the variable from memory for each access, adding unnecessary overhead. Which way is recommended? The recommended form is: private static final Logger logger = ... Thanks in advance. Best Regards Xi Yuxiang Maveo Systems Limited -- Ceki Gülcü For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp import org.apache.Facetime; ApacheCon US 2003, 18-21 November http://apachecon.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Isolation
Howdy, Use different repositories? See the javadoc for org.apache.log4j.LoggerRepository, org.apache.log4j.LogManager, org.apache.log4j.RepositorySelector. There are sample RepositorySelector implementations in the log4j sandbox CVS as well. Yoav Shapira Millennium ChemInformatics -Original Message- From: Joe Weder [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 8:12 AM To: Log4J Users List Subject: Isolation Having problems with isolation/interference with use of Log4j from other vendors and our application server (JOnAS http://www.bullsoft.com/ejb/index.html) and now JMeter. Our application consists of Java applications and ejbs, etc... web-application solutions (I've seen) for isolation do not help. Since there appears to be a single instance of the root logger in a JVM, and since pieces of our application may be running the same JVM (I have no control over this nor do I wish to endure any such burden) with 3rd party software, and we all want to configure the logging, how the heck do we avoid this conflict. I'd would like to end this once and for all. I would appreciate any suggestions from the group. I'm fairly new to log4j and this mailing list - sorry if this has been covered before. Joe Weder This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DailyRollingFileAppender with filesize option
Howdy, Here's a pointer: http://marc.theaimsgroup.com/?l=log4j-userr=1w=2 Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 25, 2003 11:07 AM To: Log4J Users List Subject: DailyRollingFileAppender with filesize option Has anyone already already created a RollingFileAppender which rolls at midnight and also if the filesize limit is exceeded ? Thanks for any pointers. Shuchi This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 4.1.24 and log4j -1.2.8.jar
Howdy, When I put my log4j -1.2.8 in the jak*/common/lib directory, Tomcat refuses to start Not the right place. Put it in the WEB-INF/lib directory of your webapp. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configuring SMTPAppender in log4j.properties
Howdy, Search the list archives... Yoav Shapira Millennium ChemInformatics -Original Message- From: Jain, Siddharth (ODC - Satyam) [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 9:35 AM To: [EMAIL PROTECTED] Subject: Configuring SMTPAppender in log4j.properties Hi, I want to configure SMTPAppender so that I can send out mails to multiple addresses in case of all levels, that would be configurable. Any help in this regard would be appreciated. Thanks Siddharth Jain GTS Web Services Merrill Lynch - Satyam ADC Satyam Technology Centre This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logfactor5 download?
Howdy, I thought it was included in the log4j download itself?? You may wish to use Chainsaw instead of LogFactor5, as the former is being actively developed and has a bunch of awesome new features planned as part of the log4j 1.3 release. Yoav Shapira Millennium ChemInformatics -Original Message- From: Walker, Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 3:53 PM To: '[EMAIL PROTECTED]' Subject: logfactor5 download? The main jakarta website provides details on the LogFactor5 tool for viewing log4j output: http://jakarta.apache.org/log4j/docs/lf5/features.html http://jakarta.apache.org/log4j/docs/lf5/features.html My question is - where can I obtain this tool, now that its development has been (as I understand it) discontinued by servidium / thoughworks? Thanks Donald. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Plans for supporting a build in level of trace
Howdy, Why? Yoav Shapira Millennium ChemInformatics -Original Message- From: Jensen, Jeff [mailto:[EMAIL PROTECTED] Sent: Monday, September 22, 2003 10:45 AM To: Log4J Users List Subject: RE: Plans for supporting a build in level of trace I also have wanted a TRACE level supported in Log4j for quite awhile. I hope it is added soon... -Original Message- From: Dennis Cook [mailto:[EMAIL PROTECTED] Sent: Saturday, September 20, 2003 8:24 PM To: [EMAIL PROTECTED] Subject: Plans for supporting a build in level of trace I have been using the commons-logging package with JDK1.4 for a while now and just tried plug in the log4j package. The application is making use of the the commons-logging debug and trace levels. But in log4j they both print out as DEBUG level. Does anyone know if support trace will be added to future versions of log4j? - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Plans for supporting a build in level of trace
Howdy, TRACE or FINE is one that many seem to agree is sensible and required. That's the part I'm not convinced of. How do you support the above? I think the idea is, no matter how many or few default levels there are, the defaults should cover the range of the logging space completely. FATAL pretty much covers it on one end of the spectrum. On the other end we need a logging level whose messages would be so verbose and so often called that we would almost never need a finer level. DEBUG is too general purpose for that. I disagree, think DEBUG is fine for the other end of the spectrum, and wouldn't use something lower than that. However, if there's really an overwhelming majority of people who disagree, then by definition I'm in the minority and these levels should be added ;) But I'm yet to be convinced this is the case... Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Plans for supporting a build in level of trace
Howdy, To separate concerns. Because trace info is a specific level, more minutia than debug info. That's your use-case, not mine. Both are debug for me. I never want one without the other. theValue=... is useless if I don't know what method it's in. Having TRACE in Log4j means: 1) No requirement to extend Log4j on each project; it is an intrinsic logging type. No such requirement exists in any organization I've ever worked, people use debug-level statement without extending log4j. People who use JDK 1.4 don't use the trace level. But that's only my experience, which is no less or more meaningful than anyone else's. 3) People want it, it does not break backwards compatibility, and it adds one more level of logging clarity. Convince me that a majority wants it. How come it doesn't come up more often on the log4j user list? 4) It matches levels with commons-logging. Why does it have trace? ;-) SOLELY because JDK 1.4 has it and commons-logging was designed to map to both log4j and commons-logging (among other logging kits). As Paul said, this is an eternal debate, kind of like whether to include version numbers of a release in the jar file name. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Plans for supporting a build in level of trace
Howdy, I agree that this debate will carry on forever, because we all work differently. I believe having one trace level is good compromise. The way I work is to put debug statements into the code to decipher what is happening in the program flow, but I would love to have a trace level to print out parameter values or variable values. The debug level gets extremely verbose when logging out array values etc and all you are interested in is program flow. Interesting that the above is exactly the opposite of what Jeff's use-case is: trace for entering/exiting methods, debug for variable values ;) Yoav This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Plans for supporting a build in level of trace
Howdy, It does not really matter what TRACE level gets used for. Each development team / organization will have their interpretation of it depending on how they intend to use the information logged at both levels. I agree, it doesn't matter what it's used for, only if it's used at all. More importantly - having a level more verbose than DEBUG is very handy. We Very handy for you. 1. TRACE level 2. An extension of DailyRollingFileAppender that also uses filesize as a rolling criterion 3. MBeans support Would you consider 2 and 3 as important to the core of log4j as 1 above? Clearly you think 1 belongs in the native log4j core. The point I'm making is not as much about the TRACE level per se. I know some people want it and use it. It's about adding a feature to the core of a product where: - It's not clear how useful the feature is, and - It's not clear what the backwards compatibility implications are, especially for organizations that already have their own custom TRACE level (or other levels that go between DEBUG and OFF). Hypothetically speaking, let's say there was a log4j sandbox jar with a Level class replacement that includes a TRACE (and maybe FINE, FINER, FINEST, REALLY_FINEST, ABSOLUTELY_FINEST, IT_CANT_GET_ANY_FINER, etc ;) -- just kidding) level, would that be useful for people? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Messages Going to Multiple Loggers
Howdy, Try setting additivity=false for the email appender. Yoav Shapira Millennium ChemInformatics -Original Message- From: Dhruva B. Reddy [mailto:[EMAIL PROTECTED] Sent: Friday, September 19, 2003 12:57 PM To: [EMAIL PROTECTED] Subject: Messages Going to Multiple Loggers I am using Log4J 1.2.8 for a standalone application running on Linux. I have two loggers defined--one for general use that goes to syslog and another for sending e-mails when the application starts and finishes. I use the following configuration: # General logging properties... log4j.rootLogger=debug,general # Log to syslog... log4j.appender.general=org.apache.log4j.net.SyslogAppender log4j.appender.general.SyslogHost=localhost log4j.appender.general.layout=org.apache.log4j.PatternLayout log4j.appender.general.layout.ConversionPattern=%p: %m log4j.appender.general.Facility=local7 # For sending e-mails... log4j.logger.notify=debug,email log4j.appender.email=org.apache.log4j.net.SMTPAppender [EMAIL PROTECTED] [EMAIL PROTECTED] log4j.appender.email.SMTPHost=localhost log4j.appender.email.subject=Something Happened log4j.appender.email.layout=org.apache.log4j.PatternLayout log4j.appender.email.layout.ConversionPattern=%m In the code in which I wish to send an e-mail, I do this: // Need this for general logging... Logger log = Logger.getLogger(SomeClass.class); // Need this notification of specific events... Logger email = Logger.getLogger(notify); The problem is that when I use email, the message is not only e-mailed, but it also goes to syslog (which I don't want). Is there a way to make these log messages appear only in e-mail messages? Thanks, Dhruva __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Converting log4j.properties to log4j.xml
Howdy, There's no overriding reason usually to move from properties to XML files for log4j configuration. XML configuration does do a couple of things properties can't, although off the top of my head I can't remember what those things are. OTOH, as always, XML is more verbose than plaintext, takes longer to parse/load/unmarshal/whatever you do with it. Yoav Shapira Millennium ChemInformatics -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 8:05 PM To: 'Log4J Users List' Subject: Converting log4j.properties to log4j.xml Is it true that the 3 lines in my log4j.properties file: log4j.logger.org.apache.commons=ERROR log4j.logger.org.apache.struts=WARN log4j.logger.servletunit.struts=WARN Will end up as 9 lines in log4j.xml (carriage returns aside) logger name=org.apache.commons level value=WARN/ /logger logger name=org.apache.struts level value=WARN/ /logger logger name=servletunit.struts level value=WARN/ /logger Just want to verify that this is the simplest way to convert a .properties to an .xml file? Also, what's the main reason for converting - validation against a DTD? Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Dynamically change logging levels through a servlet?
Howdy, And please let me know if you run into any features you need not supported by the sandbox Configuration servlet. Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 6:55 AM To: Log4J Users List Subject: Re: Dynamically change logging levels through a servlet? check out the jakarta-log4j-sandbox from cvs.apache.org -- Nigel Byrnes E-Commerce, Direct Line 0845 878 2922 White, Joshua A (HTSC, CASD) To: 'Log4J Users List' [EMAIL PROTECTED] [EMAIL PROTECTED]cc: rtford.comSubject: Dynamically change logging levels through a servlet? 18/09/2003 11:42 Please respond to Log4J Users List Someone had posted earlier that if you are running a web application, you can create a servlet which will enable you to dynamically change your logging thresholds. Could someone point me towards an example? Thanks, Joshua This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Direct Line Group Services Limited, registered in England no.3001989, registered office 3 Edridge Road, Croydon, Surrey, CR9 1AG. The following are also members of the Direct Line group of companies: Direct Line Insurance plc, a member of the General Insurance Standards Council and Direct Line Life Insurance Company Limited and Direct Line Unit Trusts Limited, both regulated by the Financial Services Authority. Loans, Mortgages, Credit Cards and Savings provided by Direct Line Financial Services Limited, registered in England number 2372702, registered office 3 Edridge Road, Croydon, Surrey, CR9 1AG. All are members of The Royal Bank of Scotland Group. This e-mail is intended for the addressee only and may contain confidential, proprietary or legally privileged information. If you are not the intended recipient of this e-mail, you should notify us immediately and delete it. You should not copy, print, distribute, disclose or use any part of it. We reserve the right to monitor and record all electronic communications through our networks. We cannot accept any liability for viruses transmitted via this e-mail once it has left our networks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Interesting clover-related issue
Howdy, I use log4j as you all know ;) To observe good performance practices, I surround my logger.debug statements in if(logger.isDebugEnabled()) blocks. All works well. I have many JUnit tests, and integrated unit test coverage reporting with Clover (http://www.thecortex.net/clover/). Let's say I'm testing class SomeObject, and the JUnit class is SomeObjectTester. In my tests, I want to exercise the logger.debug blocks as well for maximum coverage, so prior to starting the tests I do the following in the SomeObjectTester class: Logger someObjectLogger = Logger.getLogger(SomeObject.class.getName()); someObjectLogger.setLevel(Level.DEBUG); And that works fine, no problems, the debug blocks are exercised. However, because all the if(logger.isDebugEnabled()) checks are true, never false, I can never get 100% code coverage. So one solution would be to run all the tests twice, once with debug-level logging enabled for the tested class, and once with a higher level threshold. But that seems annoying, slow, not elegant. Has anyone run into this before, come up or can think of a different solution to getting 100% code coverage for this coding pattern? Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Advice needed
Howdy, 1 - Is there an upper file limit? Only what's imposed by your filesystem. 2GB by default on many filesystems I believe. 2 - As I understand it Log4j *will not* shut down our app if it has a problem. You understand correctly. 3 - Is it bad practice to allow log files to grow that big? I would say yes, unless you have (and want to use) some sort of extracting tool. When they're that big they're too verbose and long for a human to analyze in a reasonable amount of time. We will probably keep our logging quite verbose for the first while when we go live. Why? A big part of log4j is the ability to turn verbosity on/off at runtime. I would start with it off and use a mechanism like the log4j sandbox configuration servlet to turn on selected classes/packages at runtime in production as the need arises. Or even configureAndWatch if you're not in a webapp environment. Should be rolling on file size instead of date? Either policy can make sense, depending on your app. As I believe what I said above, our log files for a given day tend to be quite small ( 10K) and I roll on date, not size. Can we roll on both date and file size? ie: new file each day unless it reaches a certain size. Not until log4j 1.3 or unless you write a custom appender that combined RollingFileAppender and DailyRollingFileAppender functionality. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4j best practices
Howdy, I think that's a better practice because I don't like mixing configuration files and classes. Other people do like this approach and the auto-initialization you get with it. Yoav Shapira Millennium ChemInformatics -Original Message- From: White, Joshua A (HTSC, CASD) [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 6:31 AM To: 'Log4J Users List' Subject: Log4j best practices All, I was looking through a weblogic sample application recently that used log4j. I noticed that it referenced the log4j.properties file by specifying it in a command line property (Dlog4j.config=log4j.properties) rather than let log4j look on the classpath. Also, the properties file was deployed separately from the ear file. I am looking to incorporate log4j in a future weblogic application. Is this the best practice? Is there a reason log4j was set up this way? Regards, Joshua This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4j Initialization
Howdy, All the other classes contain this member init: private static Logger log = GenLogger.getLogger(GenLogConfiguratorBean.class); Why would you want to have all your classes share the same Logger instance? You wouldn't be able to change the debugging levels for selected classes at runtime, only all at once... Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Fwd: tomcat 4.1.27 log4j 1.2.8 struts 1.1 = crash on logger.debug()]
Howdy, to my ae.jar file, even though I have explicitly told it not to. I am sorry that I didn't unzip my jar files earlier, but I figured checking JBuilders jar gui screen was enough. So Chalk one up for open source! It was a JBuilder bug. And chalk another bug to overcomplicated, overpriced, over-abstract IDEs. But I'm not going to get stated on this topic ;) Why are the JBoss tomcat jars in Tomcat? They're there in the JBoss distribution of tomcat only, not in the standalone tomcat distribution. They're there to support some custom embedded tomcat functionality JBoss does. I am instantiating my ejb session bean as a local class in my web app so that I don't have to set up a jboss container for this development session. The idea here is that I can decide at deployment time how many tiers that my application should use. Basically, forget about it with current versions of tomcat and JBoss. Between the classloading and JNDI implementations alone, you're screwed ;) If you want JBoss-Tomcat, use the bundle. If you want tomcat standalone, use its standalone distribution that doesn't have any tomcat jars. This architecture selection carries significant weight and to try to do it at runtime is difficult at best. That said, if you come up with a working solution, I for one would be interested in the details ;) Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: No of Logger instances
Howdy, I don't think it makes a significant difference in performance if you already have a system that's large enough to have tens of thousands of classes running, which is the system size you'd have to have for the number of Logger instances to matter even a tiny bit. Note that you don't have to use the class name for the logger name. Instead, you can define your code into logical component/modules, like SECURITY, DBACCESS, PRESENTATION, etc. and name all the loggers in one module the same (e.g. the module name). This and other strategies are briefly discussed in the log4j short manual. Yoav Shapira Millennium ChemInformatics -Original Message- From: Kalra, Ashwani [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 12:16 AM To: Log4j List (E-mail) Subject: No of Logger instances Hi, Since there will be as many instances of logger as the different names that we pass, Which is good way of reducing the no of instances. Logger.getLogger(com.abc) //passing just he package or Logger.getLogger(com.abc.Class1), Logger.getLogger(com.abc.Class2) etc. Which is better in terms of memory management and performance. Regds Ashwani Kalra This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: No of Logger instances
Howdy, It won't be an issue. We have systems with tens of thousands of classes loaded at runtime (and many of them in the working set of the app). We use the logger name = fully-qualified class name convention, and it works perfectly for us with no performance degradation. What does make a big difference, since you seem to care about this, is using if(logger.isDebugEnabled()) { ... } around logger.debug statements. Yoav Shapira Millennium ChemInformatics -Original Message- From: Kalra, Ashwani [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 9:30 AM To: Log4J Users List Subject: RE: No of Logger instances Thanks, Yeah we can give any logical name. Actually I had a debate on passing the fully qualified class name(I do not favour it). As It will create so many logger objects. Performance might not be an issue , but the no of Logger objects may be ? -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 6:20 PM To: Log4J Users List Subject: RE: No of Logger instances Howdy, I don't think it makes a significant difference in performance if you already have a system that's large enough to have tens of thousands of classes running, which is the system size you'd have to have for the number of Logger instances to matter even a tiny bit. Note that you don't have to use the class name for the logger name. Instead, you can define your code into logical component/modules, like SECURITY, DBACCESS, PRESENTATION, etc. and name all the loggers in one module the same (e.g. the module name). This and other strategies are briefly discussed in the log4j short manual. Yoav Shapira Millennium ChemInformatics -Original Message- From: Kalra, Ashwani [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 12:16 AM To: Log4j List (E-mail) Subject: No of Logger instances Hi, Since there will be as many instances of logger as the different names that we pass, Which is good way of reducing the no of instances. Logger.getLogger(com.abc) //passing just he package or Logger.getLogger(com.abc.Class1), Logger.getLogger(com.abc.Class2) etc. Which is better in terms of memory management and performance. Regds Ashwani Kalra This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can I create empty log files (without logging events)?
Howdy, It's not a stupid question, but (without knowing better) it seems like a stupid requirement. Since you're already using a custom appender, why not modify it to touch i.e. create the log file in its activateOptions method? Better yet, add a configurable option to create an empty file. It may be more of a java.io issue then (maybe open the file, write an empty string to it, flush the writer?). Yoav Shapira Millennium ChemInformatics -Original Message- From: Stefan Hellwig [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 4:47 AM To: [EMAIL PROTECTED] Subject: Can I create empty log files (without logging events)? Hi! First, let me say that I'm very, very new to log4j and all, so the following question(s) might sound stupid to you - in that case please forgive me. The challange that I'm facing right now it this: I'll have to make some changes to an application I know virtually nothing about - someone at my company thought this would be a good idea... That appliation is using log4j and a ConfigurableDailyRollingFileAppender which is derived from DailyRollingFileAppender. Now, this works in general... BUT... now they want me to change the logging behavior in a way that the logging system generates log files even when there are NO logging events (when the system wasn't doing anything). These files will of course be empty (in a shell I would do a touch and that's it) and - in other words - completely useless. That's what I told them also but they still want to have it. Is there any way to get log4j to generate empty log files even without any logging events? By the way, these log files have to be generated every two minutes - even if they are empty... Any ideas? I mean I could also set up a cron job that generates empty files every two minutes but I doubt that I'll get this in sync with log4j. Thank you very much in advance for answering my stupid question. Regards, Stefan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: RepositorySelector
Howdy, Look in the log4j sandbox CVS, there are a couple of selectors (JNDI and ServletContext, I believe). http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/ log4j/selector/ These may do the whole job for you, or at least serve as examples. Yoav Shapira Millennium ChemInformatics -Original Message- From: Andreas Bothner [ MTN - Innovation Centre ] [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 09, 2003 6:52 AM To: Log4J Users List Subject: RepositorySelector Hi, I am using Weblogic Server and am considering implementing a RepositorySelector as discussed by Ceki in http://www.qos.ch/logging/sc.html, and in Chapter 8 of his manual. What I do not know how to do, is to ensure that the Container removes the repository / hierarchy when an EAR / EJB jar / WAR is undeployed or re-deployed. I am busy asking BEA if they have looked at this. I just wanted to ask if anybody else has implemented something like this for Weblogic. Regards, Andreas Bothner Systems Integrator Mobile Telephone Networks - Information Systems NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/email_disclaimer.asp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logging JDBC objects
Howdy, I personally am not a big fan of logging these types of objects: I much prefer logging the beans I create from result sets (or DAO objects, or whatever we call them this week). However, one possibility for you would be to create a ResultSetRenderer (implements http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/or/ObjectRende rer.html) or a PreparedStatementRenderer... Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 8:30 PM To: [EMAIL PROTECTED] Subject: logging JDBC objects Hello, Has anyone looked at logging JDBC objects, like PreparedStatement and ResultSet classes? They don't have any built-in ways of displaying their contents, so I'm considering creating a wrapper class to do this for me, but I thought I'd check the list to see if anyone else has already solved this problem before I proceed. --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: define different level for logging at file basis
Howdy, It should work... I define class-specific logging levels in propery files all the time. Of course, what you did was also make only the Sort class append to the A2 appender. You may want to keep A2 associated with the whole package, so do: log4j.logger.org.apache.log4j.examples=WARN, A2 log4j.logger.org.apache.log4j.examples.Sort=INFO Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 10:55 AM To: [EMAIL PROTECTED] Subject: AW: define different level for logging at file basis Hi Everybody, I tried to define a level for an class. The line in the log4j example sort4.properties looks like this: log4j.logger.org.apache.log4j.examples=INFO, A2 and I want to define it for a single class like this: log4j.logger.org.apache.log4j.examples.Sort=INFO, A2 Does anyone know why this dosn't work? best regards Klaus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: define different level for logging at file basis
Howdy, Do you have a appenders named R and D defined in the file? Also, you know you don't have to assign appenders to all the packages, only to the root logger, right? Unless you're doing non-default additivity, which doesn't seem to be the case, all loggers will inherit appenders. Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 11:22 AM To: [EMAIL PROTECTED] Subject: AW: define different level for logging at file basis Hi, my concrete Property File looks like this (only the first part): log4j.rootCategory=WARN, A1, R, D log4j.logger.com.lhsystems.travelex.framework=ALL, A1,D, R log4j.logger.com.lhsystems=ERROR, R log4j.logger.com.lhsystems.travelex.framework.components=WARN, ALL, A1, R, D log4j.logger.com.lhsystems.travelex.framework.components.BasicComponentFact o ry=ALL, A1, R, D log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] %c{3} - %m%n and I get the Folowing Error: InInitializerError java.lang.ExceptionInInitializerError: java.lang.ClassCastException: org.apache.log4j.Logger at com.lhsystems.travelex.framework.components.BasicComponentFactory The critical line is: log4j.logger.com.lhsystems.travelex.framework.components.BasicComponentFact o ry=ALL, A1, R, D if this line is a comment, everythinbg is working fine Klaus -Ursprüngliche Nachricht- Von: Shapira, Yoav [mailto:[EMAIL PROTECTED] Gesendet am: Donnerstag, 4. September 2003 16:59 An: Log4J Users List Betreff: RE: define different level for logging at file basis Howdy, It should work... I define class-specific logging levels in propery files all the time. Of course, what you did was also make only the Sort class append to the A2 appender. You may want to keep A2 associated with the whole package, so do: log4j.logger.org.apache.log4j.examples=WARN, A2 log4j.logger.org.apache.log4j.examples.Sort=INFO Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 10:55 AM To: [EMAIL PROTECTED] Subject: AW: define different level for logging at file basis Hi Everybody, I tried to define a level for an class. The line in the log4j example sort4.properties looks like this: log4j.logger.org.apache.log4j.examples=INFO, A2 and I want to define it for a single class like this: log4j.logger.org.apache.log4j.examples.Sort=INFO, A2 Does anyone know why this dosn't work? best regards Klaus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logging JDBC objects
Howdy, Another take on this is BeanUtils#describe(Object bean) which returns a Map of properties. Java.util.HashMap's toString() method prints out very nicely, so you don't have to do much work here. (I'm talking about jakarta-commons-beanutils of course ;)) A downside to both the above and I assume Senior Larmee's approach is that they only invoke public methods, so you don't get private state in your logging output. Yoav Shapira Millennium ChemInformatics -Original Message- From: Donald Larmee | ALTERTHOUGHT [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 10:02 AM To: Log4J Users List Subject: RE: logging JDBC objects In the past I have used a generic bean-util style widget that uses reflection to introspect any passed Object, and dumps its contents into a formatted Stringwhich is then in turn logged. The DumpUtil (as I have implemented anyway) works well for reasonably simple/flat Objects, but does not have the smarts to generically traverse into Collections/arrays. If interested I can post/email. -don At 08:47 AM 9/4/2003 -0400, Shapira, Yoav wrote: Howdy, I personally am not a big fan of logging these types of objects: I much prefer logging the beans I create from result sets (or DAO objects, or whatever we call them this week). However, one possibility for you would be to create a ResultSetRenderer (implements http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/or/ObjectRen de rer.html) or a PreparedStatementRenderer... Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 8:30 PM To: [EMAIL PROTECTED] Subject: logging JDBC objects Hello, Has anyone looked at logging JDBC objects, like PreparedStatement and ResultSet classes? They don't have any built-in ways of displaying their contents, so I'm considering creating a wrapper class to do this for me, but I thought I'd check the list to see if anyone else has already solved this problem before I proceed. --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Donald H. Larmee ALTERthought, Inc. 804.301.8867 (c) www.alterthought.com ___ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Class FileWatchdog
Howdy, You use it all the time if you do configureAndWatch() for log4j. It has a concrete implementation as well, I think (PropertyWatchdog or something like that). The name of the class pretty much explains it: watch over a file and fire an event if the file changes. It's a common pattern with dozens of implementations all over the place. Yoav Shapira Millennium ChemInformatics -Original Message- From: Raveendranath, Rohith (LNG - AUS) [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2003 8:46 PM To: 'Log4J Users List' Subject: Class FileWatchdog Hi i was looking at the Log4j API's There is a Abstract class : Class FileWatchdog has anyone used this ? can any one provide a brief idea abt this class plzz ? Thanks in Advance Rohith -Original Message- From: Raveendranath, Rohith (LNG - AUS) [mailto:[EMAIL PROTECTED] Sent: Friday, 29 August 2003 10:30 AM To: 'Log4J Users List' Subject: RE: Behaviour in Log4j when Logfile is deleted. whetrher logging activity is critcal for any application will be the guiding factor to decide whether the application should crash i case of logging failure. Morover what iam asking is should't a warning be thrown on the console saying that the logging cannot be proceeded or so -Original Message- From: Charles Hudak [mailto:[EMAIL PROTECTED] Sent: Friday, 29 August 2003 10:23 AM To: 'Log4J Users List' Subject: RE: Behaviour in Log4j when Logfile is deleted. log4j is fail stop. Logging doesn't and shouldn't throw an exception to your application and cause it to crash. -Original Message- From: Raveendranath, Rohith (LNG - AUS) [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2003 17:12 To: 'Log4J Users List' Subject: Behaviour in Log4j when Logfile is deleted. Hi all, I am using Lo4j 1.2.8, During the cource of my application running i deleted the log file. Now there is no exception/error thrown. The application keeps on running ,possibly ignoring the logging part. Whys is this behaviour happening,should the log4j throw exception as its no longer finding the Log File. Thanks and regards Rohith This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's permission. We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this e-mail. We cannot accept liability for any loss or damage caused by software viruses. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's permission. We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this e-mail. We cannot accept liability for any loss or damage caused by software viruses. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's permission. We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this e-mail. We cannot accept liability for any loss or damage caused by software viruses. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not use, disclose or distribute this e-mail without the author's permission. We have taken precautions to minimise the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this e-mail. We cannot accept liability for any loss or damage caused by software viruses. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To
RE: how do I log an exception stacktrace
Howdy, try { String a = null; System.out.println(a.length()); } catch (Exception e) { logger.error(Error printing string: , e); } Note the comma, i.e. the error(Object, Throwable) version of the API. All the levels (logger.info(...), logger.warn(...), etc) have a version of their signature with a Throwable argument. Yoav Shapira Millennium ChemInformatics -Original Message- From: Andreas Bothner [ MTN - Innovation Centre ] [mailto:[EMAIL PROTECTED] Sent: Friday, August 29, 2003 9:55 AM To: Log4J Users List Subject: how do I log an exception stacktrace Hi, I apologize if this is a stupid question, but how would I log out an exception's stacktrace using logger.debug() ? Regards, Andreas Bothner Systems Integrator NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/email_disclaimer.asp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log file location
Howdy, Look in the JBoss log for errors initializing log4j. Turn -Dlog4j.debug=true to see log4j internal debugging output. Try different paths for your File argument, e.g. d:\jboss\errors.log or d://jboss/errors.log. Yoav Shapira Millennium ChemInformatics -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 8:56 AM To: '[EMAIL PROTECTED]' Subject: Log file location Hi, I am unable to set log file location. I searched the forum for old messages and found some. I tried the way it was mentioned in those messages, but still my problem is not solved. My log4j.properties file is as follows: log4j.rootCategory=WARN, dest1, R log4j.appender.dest1=org.apache.log4j.ConsoleAppender log4j.appender.dest1.layout=org.apache.log4j.PatternLayout log4j.appender.dest1.layout.ConversionPattern=%-5p: %m%n appender writes to a file log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%-5p: %m%n log4j.appender.R.File=d:/jboss/errors.log I packaged by application as .ear and deployed it on JBoss running on Win 2000. When I run the application, I can see the log messages on JBoss console, but these messages are not getting stored in the file I've specified (d:/jboss/errors.log). What could be the problem? In fact, initially I tried ${jboss.home}/errors.log, but it didn't work. So I thought of hard coding the file location and tried it out. Still the same problem. Can someone please suggest a solution? Thanks Sriram This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log file location
Howdy, I used log4j.debug=true in log4j.properties, but there is no internal debugging output. It's -Dlog4j.debug=true as a system property, as documented in the log4j manual. If I specify as follows: log4j.appender.R.File=errors.log It will get created in the server's working directory I think. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Picking up log4j.properties
Howdy, static Category cat = Category.getInstance(MyClass.class.getName()); In order to write logs to a file, should I modify the above line; and if yes, can you pl. tell me how I need to modify it? I would suggest modifying it as private static final Logger logger = Logger.getLogger(MyClass.class.getName()) as loggers should be private and final, and Category class is deprecated. This has nothing to do with File appenders or any other appenders: you obtain loggers independently of any appender configuration. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Location of log files
Howsdy, Try filter token=token value=value / outside a filterset. (i.e. no filterset at all, just the above line above the copy task. Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 11:36 AM To: Log4J Users List Subject: RE: Location of log files Hello, This is a question about a post from several weeks ago. I wasn't ready to try it at the time, but I saved it because I knew I'd need it later on ... :) When I tried to use filtering as described in the original post (actually, I created a filterset inside the copy tag), it works fine except that on Windows 2K it contains back-slashes(\) from my $CATALINA_HOME env variable and forward-slashes(/) from the subpath info inside of Ant. Then, when log4j gets it, the backslashes are effectively ignored (probably interpreted as escaping the next character) so log4j complains that no such directory exists. Is there a way to get log4j to accept either path-separator character, or alternately is anyone aware of an Ant function to force filtering to use the platform-dependent path separator when replacing text ?? My Ant build.xml looks basically like this: property name=installdir value=${env.CATALINA_HOME}/webapps/MYAPP/ target ... copy todir=${build}/WEB_INF/classes file=${basedir}/config/log4j.xml filterset filter type=INSTALLDIR value=${installdir/WEB_INF/ /filterset /copy /target And my log4j.xml looks roughly like this: appender name=XYZ class=... RollingFileApppender param name=file value=@INSTALLDIR@/myapp.log/ . /appender In the destination log4j.xml file, the value for the appender's file param is C:\Java\tomcat/webapps/MYAPP/WEB_INF/myapp.log. Any thoughts ??? --- regards --- Larry At 01:54 PM 8/5/03 -0400, Shapira, Yoav wrote: Howdy, This is a common problem, and you have several options. The logging works fine. The problem is specifying the location of the log file. I use log4j.xml to configure log4j. In there I have to specify the location of the log file as absolute path. This creates a problem because we have to edit You don't have to specify the path as absolute: it can be relative (to the working directory), and it can contain environment variables. log4j.xml during each deployment of our application to edit the location of the log file. Another option is to automate this by copying the log4j.xml file with filtering=true in Ant. In log4j.xml you'd have a token value for the log file path, e.g. @logFilePath@, and when deploying you'd have Ant replace this value with a value coming from an Ant property. I attempted to solve the problem by adding the following code in a utility class rootLogger = Logger.getRootLogger(); FileAppender fp = (FileAppender) rootLogger.getAppender(LOGFILE); This is yet another option, the pure programmatic way. I find this useful some time, but cleaner if you create the appender programmatically as well, i.e. Layout l = ... String logFilePath = Appender app = new FileAppder(l, logFilePath); Logger.getRootLogger().addAppender(app) Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Location of log files
Howdy, Ant can handle either way, forward or back, as long as it's consistent. The problem arises when a single string uses mixed slashes. Ant's FixCRLF task works in this area and might be useful here. Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 1:57 PM To: Log4J Users List Subject: RE: Location of log files Yoav, Thanks for the suggestion, but that doesn't work either. So now I have: property name=installdir value=${env.CATALINA_HOME}/webapps/MYAPP/ target ... filter token=INSTALLDIR value=${installdir/WEB_INF/ copy todir=${build}/WEB_INF/classes file=${basedir}/config/log4j.xml filtering=true/ /target And the generated log4j.xml file has the same mixed / \ values. Beyond that, I tried to manually change all the '/' to '\' in the generated log4j.xml file and when I ran it, it put the file under tomcat/bin and its name was the concatenation of all the path elements. I then tried to escape the backslash and that worked fine! This would sound like a problem with the xml parser log4j is using when it is parsing the value param and handing it to log4j. Oddly enough, when I changed all the backslash's to forward-slash's, that worked too. I thought on a Windoze box, Java used the system-dependent filenaming conventions when creating a FileOutputStream (which is all that log4j does with the filename)? So are you doing this currently on a windoze or *nix box? I can see how it would work in a non-M$ environment. Thoughts? --- regards --- Larry At 12:39 PM 8/27/03 -0400, you wrote: Howsdy, Try filter token=token value=value / outside a filterset. (i.e. no filterset at all, just the above line above the copy task. Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 11:36 AM To: Log4J Users List Subject: RE: Location of log files Hello, This is a question about a post from several weeks ago. I wasn't ready to try it at the time, but I saved it because I knew I'd need it later on ... :) When I tried to use filtering as described in the original post (actually, I created a filterset inside the copy tag), it works fine except that on Windows 2K it contains back-slashes(\) from my $CATALINA_HOME env variable and forward-slashes(/) from the subpath info inside of Ant. Then, when log4j gets it, the backslashes are effectively ignored (probably interpreted as escaping the next character) so log4j complains that no such directory exists. Is there a way to get log4j to accept either path-separator character, or alternately is anyone aware of an Ant function to force filtering to use the platform-dependent path separator when replacing text ?? My Ant build.xml looks basically like this: property name=installdir value=${env.CATALINA_HOME}/webapps/MYAPP/ target ... copy todir=${build}/WEB_INF/classes file=${basedir}/config/log4j.xml filterset filter type=INSTALLDIR value=${installdir/WEB_INF/ /filterset /copy /target And my log4j.xml looks roughly like this: appender name=XYZ class=... RollingFileApppender param name=file value=@INSTALLDIR@/myapp.log/ . /appender In the destination log4j.xml file, the value for the appender's file param is C:\Java\tomcat/webapps/MYAPP/WEB_INF/myapp.log. Any thoughts ??? --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: duplicate logging?
Howdy, How are you configuring log4j? Yoav Shapira Millennium ChemInformatics -Original Message- From: Rishikesh Tembe [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 2:43 PM To: Log4J Users List Subject: duplicate logging? Hi all, If in my code I have logger.info(AIN: Received 'ReadEvent' from Thread1 ); why do I get the following in my log file? snip AIN: Received 'ReadEvent' from Thread1 2003-08-27 11:29:08,463 [1] : AIN: Received 'ReadEvent' from Thread1 /snip I am using PatternLayout with the pattern as %d [%t] : %m%n -- log4j.properties -- log4j.rootLogger=INFO, d1 log4j.appender.d1=org.apache.log4j.FileAppender log4j.appender.d1.File=threads.log log4j.appender.d1.layout=org.apache.log4j.PatternLayout log4j.appender.d1.layout.ConversionPattern=%d [%t] : %m%n thanks, Rishi = ___ _ Yahoo! India Promos: Win TVs, Bikes, DVD players more! Go to http://in.promos.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Location of log files
Howdy, Cool, thanks for posting your final solution! ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 3:56 PM To: Log4J Users List Subject: RE: Location of log files Yaov, Agg why didn't I check the book before posting that!! On page 101 of Ceki's book, the File option has a full description associated with it, including the note about having to escape the '\' on the windoze platform, and also about being able to simply use the '/' instead. Having said that, it might be useful to have that note in the javadocs too. :) So basically all I need to do is simply convert my CATALINA_HOME value to use '/'. Sorry for wasting everyone's time. BTW, I did look at the fixCRLF task, but that operates on the entire file, and I wasn't sure that there wouldn't be any '\' characters somewhere else in my log4j.xml file. So, the final solution that I came up with is as follows, and this should work on both Windoze *nix. property name=installdir value=${env.CATALINA_HOME}/webapps/MYAPP/ target ... pathconvert dirsep=/ property=logfile path path=${installdir}/WEB-INF/${ant.project.name}.log/ /pathconvert filter token=LOGFILE value=${logfile}/ copy todir=${build}/WEB_INF/classes file=${basedir}/config/log4j.xml filtering=true/ /target Thanks again for all your help! --- regards --- Larry At 01:54 PM 8/27/03 -0400, you wrote: Howdy, Ant can handle either way, forward or back, as long as it's consistent. The problem arises when a single string uses mixed slashes. Ant's FixCRLF task works in this area and might be useful here. Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 1:57 PM To: Log4J Users List Subject: RE: Location of log files Yoav, Thanks for the suggestion, but that doesn't work either. So now I have: property name=installdir value=${env.CATALINA_HOME}/webapps/MYAPP/ target ... filter token=INSTALLDIR value=${installdir/WEB_INF/ copy todir=${build}/WEB_INF/classes file=${basedir}/config/log4j.xml filtering=true/ /target And the generated log4j.xml file has the same mixed / \ values. Beyond that, I tried to manually change all the '/' to '\' in the generated log4j.xml file and when I ran it, it put the file under tomcat/bin and its name was the concatenation of all the path elements. I then tried to escape the backslash and that worked fine! This would sound like a problem with the xml parser log4j is using when it is parsing the value param and handing it to log4j. Oddly enough, when I changed all the backslash's to forward-slash's, that worked too. I thought on a Windoze box, Java used the system-dependent filenaming conventions when creating a FileOutputStream (which is all that log4j does with the filename)? So are you doing this currently on a windoze or *nix box? I can see how it would work in a non-M$ environment. Thoughts? --- regards --- Larry At 12:39 PM 8/27/03 -0400, you wrote: Howsdy, Try filter token=token value=value / outside a filterset. (i.e. no filterset at all, just the above line above the copy task. Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 11:36 AM To: Log4J Users List Subject: RE: Location of log files Hello, This is a question about a post from several weeks ago. I wasn't ready to try it at the time, but I saved it because I knew I'd need it later on ... :) When I tried to use filtering as described in the original post (actually, I created a filterset inside the copy tag), it works fine except that on Windows 2K it contains back-slashes(\) from my $CATALINA_HOME env variable and forward-slashes(/) from the subpath info inside of Ant. Then, when log4j gets it, the backslashes are effectively ignored (probably interpreted as escaping the next character) so log4j complains that no such directory exists. Is there a way to get log4j to accept either path-separator character, or alternately is anyone aware of an Ant function to force filtering to use the platform-dependent path separator when replacing text ?? My Ant build.xml looks basically like this: property name=installdir value=${env.CATALINA_HOME}/webapps/MYAPP/
RE: Location of log files with Tomcat
Howdy, initialization servlet that goes through the log4j.properties file making all the file locations be relative to my web app directory. The code is listed below. Consider putting this code in a ServletContextListener's contextInitialized() method, instead of a servlet's init() method, as the latter can get called multiple times at the container's behest. My questions are: - Is this a reasonable way of doing things? - Is there a better way? snip public void init() { String prefix = getServletContext().getRealPath(/); Keep in mind prefix will be null if you're running out of a packed .war file. for ( enum = props.propertyNames(); enum.hasMoreElements(); ) { pName = (String ) enum.nextElement(); if ( pName.startsWith(log4j.appender.) pName.endsWith(.File)) { Instead of doing this whole property replacement scheme, why not just specify a system-property based file name in your log4j configuration file, e.g. log4j.MyAppender.File=${CATALINA_HOME}/logs/myLog.txt The above strategy and similar ones have been discussed on this list in the past. You can search the archives for more information and examples. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems with timestamp with Log4j and JVM 1.3
Howdy, This is not a log4j issue, it's a JDK problem. I use Windows 2000, have GMT - 5 (US, Canada -- I'm in Boston) with the automatically adjust for daylight savings time box checked, and have never had any problems... Yoav Shapira Millennium ChemInformatics -Original Message- From: Dave Rathnow [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 4:54 PM To: '[EMAIL PROTECTED]' Subject: Problems with timestamp with Log4j and JVM 1.3 We are using Log4j 1.2.7 in our app and have recently found a problem that seems to only occur with JVM 1.3. We deploy on Windows and require the system time to be set to GMT. Windows has two settings for GMT, GMT - Greenwich mean time GMT - Casablanca Greanwhich mean time there is a checkbox that determines whether the server recoginizes daylight saving time, while Casablanca does not. We found a problem where, if we set the server set GMT - Greenwich mean time, and not check the checkbox for DST, all timestamp generated with PatternLayout are off by an hour. Furthermore, we've found the DailyRollingFileAppender rolls the logfile over at 23:00:00 instead of midnight. If we change the timezone to GMT - Casablanca, everything seems to work fine. Unfortunately, if we use GMT - Casablanca, all the times stored in our database are now off by an hour. We do not, however, see this problem with JVM 1.4. Has anyone else seen this before? Can anyone give me an explanation? Dave (Who HATES timezones) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to use custom property file
Howdy, Set log4j.defaultInitOverride=true. And RTFM, namely the Default Initialization section of the Short Manual on the log4j website. Yoav Shapira Millennium ChemInformatics -Original Message- From: Sanjay Gupta (sanjaygu) [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 5:23 PM To: 'Log4J Users List' Subject: How to use custom property file Hi, There is a log4j.xml in the classpath and I don't want my log4j instance to initialize with it. Instead I want to use my_log4j.xml. How do I prevent log4j from reading log4j.xml? Here is a piece of code I am trying. It reads both log4j.xml as well as my_log4j.xml. public static void main(String[] args) { if(args.length==1){ DOMConfigurator.configure(D:\\Logwriter\\my_log4j.xml); } else { System.out.println(WARNING-no conf files specified...looking for log4j.properties or log4j.xml in classpath); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logging exceptions to a separate file
Howdy, Assuming you log your exceptions with level error or higher, simply define another FileAppender for the root logger whose threshold is error. Yoav Shapira Millennium ChemInformatics -Original Message- From: Abramson, Rami [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 4:47 AM To: Log4j-User (E-mail) Subject: Logging exceptions to a separate file Hello all, We have a root logger that logs to the console and to a file. How is it possible to log all the appearing exceptions to a separate file too? thank you, Rami A. NOTICE: This communication contains information which may be proprietary, privileged or confidential. If you are not the intended recipient (or authorized to receive for the intended recipient), or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, disclose or otherwise use the information. Also, please indicate to the sender that you have received this communication in error and delete the copy you received. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with download
Howdy, I also get a link broken message (and showing that Resin is the server, and not tomcat?! ;) ;)), which is strange as I've downloaded them in the past I think. Yoav Shapira Millennium ChemInformatics -Original Message- From: Najib Coutya [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 6:03 AM To: [EMAIL PROTECTED] Subject: Problem with download Hi, I bought the log4j complete manual book and I can't download the examples from https://qos.ch/shop/products/clm/log4j/Manual.zip Any advice? Many thanks for your help. Najib Coutya | Java Development Engineer | Hutchison3G Production Facility BBC Technology | G100 | Stadium House | 68 Wood Lane | London W12 7TA T: +44 (0) 20 8576 2190 F: +44 (0) 20 8576 2224 mailto:[EMAIL PROTECTED] http://www.bbctechnology.com http://www.bbctechnology.com/ This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to change Threshhold level of run appender in program
Howdy, Logger rootLogger = Logger.getRootLogger(); AppenderSkeleton a1 = (AppendeSkeleton) rootLogget.getAppender(A1); a1.setThreshold(Level.INFO); Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 11:57 AM To: Log4J Users List Subject: How to change Threshhold level of run appender in program Hi All: I hope you can help me with this: I have 3 appenders running A1 - writes log entries to the console A2 - write DEBUG and INFO log entries to a file A3 - write WARN and above entries to a file As I develop the program I want to change the threshhold level of A1. When I am working on a section of code I want to set A1 to send DEBUG entries to the console while that code is executing. Something like A1.setThreshhold(DEBUG); . . code under development . . A1.setThreshhold(INFO); The closest thing I have come up with is - clear existing filters from A1 - add a LevelMatchFilter for DEBUG and - clear existing filters from A1 - add a LevelMatchFilter for INFO Does anyone have an other ideas how to do this? Thanks Bill - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 2 apps, 2 sets of files, common util classes
Howdy, Each app should have its own copy of the common jar. Don't place one copy of the commons jar in a common classloader repository, e.g. tomcat's $CATALINA_HOME/common/lib. Yoav Shapira Millennium ChemInformatics -Original Message- From: Bill Comer [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 8:34 AM To: [EMAIL PROTECTED] Subject: 2 apps, 2 sets of files, common util classes Hi all, We have two applications that should be writing to different log files in different directories. These applications use a set of common utility classes where the logger is set up with a statement such as: private static Logger logger = Logger.getLogger(Player.class); The problem we have is that log messages from application 'a' using this class gets its messages written to both log files for app 'a' and app 'b'. The two apps are run from separate jar files but we do not want to hard code the differences in the common util classes. Any clues on how we can avoid this ? Regards, Bill Comer Regards, Bill Comer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 2 apps, 2 sets of files, common util classes
Howdy, I also meant the inverse of my solution, which is the apps should have separate log4j.jar files. Each one should have its own copy of log4j in its WEB-INF/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: Bill Comer [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 8:51 AM To: [EMAIL PROTECTED] Subject: RE: 2 apps, 2 sets of files, common util classes To answer Yoav, Although the util classes are common they are built into the jar file for each app, so to answer your question. No they are not from a common jar file. However both apps pick up the same log4j.jar To answer Ceki. The apps are running in a separate web apps in the same servlet container ( resin) Regards, Bill Comer -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: 14 August 2003 13:42 To: Log4J Users List Subject: Re: 2 apps, 2 sets of files, common util classes Do these two applications run in a servlet container (e.g. Tomcat) or an EJB container (e.g JBoss)? At 01:34 PM 8/14/2003 +0100, you wrote: Hi all, We have two applications that should be writing to different log files in different directories. These applications use a set of common utility classes where the logger is set up with a statement such as: private static Logger logger = Logger.getLogger(Player.class); The problem we have is that log messages from application 'a' using this class gets its messages written to both log files for app 'a' and app 'b'. The two apps are run from separate jar files but we do not want to hard code the differences in the common util classes. Any clues on how we can avoid this ? Regards, Bill Comer -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: calling DOMConfigurator.configureAndWatch() 2 times
Howdy, Also, it is programmatically possible to check if Log4j has been configured previously, thus avoiding the problem (which may or may not help in this particular case). My development team creates components used throughout our enterprise, and if an application has configured Log4j, we want to avoid configuring it ourselves and instead piggy-back off their configuration. This is a good habit: we do the same thing. The code to check if Log4j has been configured follows: public static boolean isConfigured() { snip This code is also on the log4j wiki pages as it's a FAQ. Note that it's not guaranteed to be 100% effective, i.e. it might return false positives or negatives. I haven't run across such a case yet, but it's a CYA statement. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Instant Logging Article
Howdy, Even though I'm sure many have seen it, I wanted to send a link to this interesting article: http://www-106.ibm.com/developerworks/java/library/j-instlog/ The article has an overview of log4j and details on how to implement a remote instant messages (IM) appender. Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Separate configs for different webapps
Howdy, Yes. Instead of them sharing log4j.jar, put a copy of the jar in each app's WEB-INF/lib folder. Then keep the separate config files as you've done, in each app's WEB-INF/classes folder. Make sure there's no log4j.jar in tomcat's common/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:37 PM To: [EMAIL PROTECTED] Subject: Separate configs for different webapps Hi, I am probably asking a stupid question here because I am new to log4j and tomcat. I have two webapps running under tomcat (single JVM) that are sharing common libraries. I am trying to find a way to set up the logging properties such that the two webapps have different settings (i.e., different appenders, layouts, levels, etc.). I've tried putting a log4j.properties file in the classes directory for each of my webapps, but it seems it only automatically picks up the one associated with whichever webapp is started first by tomcat (the other one is never loaded). If I put an explicit call in both webapps to the PropertyConfigurator, it seems that whichever one loads last overwrites the previous settings. Can I get different settings for each of my webapps somehow? Pat Grever Software Development Engineer iIPS Connectivity - Management Applications Lab Phone: 208.396.2522 Fax: 208.396.4796 [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: discreet logging types - revisited
Howdy, I'm a fan of the Level system and its relationship, so no I'm not interested in your suggested mods, but I wanted to throw out an idea or two for you that might reduce the need for coding: - Can you use separate logger repositories as your types ? - Can you use a Filter attached to the root logger that matches based on type as an MDC attribute of the logging event? Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 3:10 PM To: [EMAIL PROTECTED] Subject: discreet logging types - revisited Hi all, Well, I'm still looking at how to use discreet logging types instead of the Level to control what messages are enabled. The difficulty resides in the need to enable/disable certain log types by package/class name. BTW, I posted my original message on 7/30/03 if you are interested. Basically, the way I've always built logging systems is by defining a set of discreet types to be used by the developers, and then allowed those types to be enabled/disabled individually. Unfortunately the level concept is fairly hard-wired into log4j. I say unfortunately not because levels are bad, but because there is no way to expand or get-around them with an alternate approach. Actually, levels can be viewed as a set of discreet types with an implicit ordering/relationship between them, but in log4j, there is no way to control the relationship test. Before I go on too much (which I do!), is there anyone else who is interested in discussing the idea of replacing the level with discreet types in the log4j package?? Basically I'm at a point where I need to make some decisions regarding how to proceed. If other members are interested in pursuing this idea, then I'll explore the idea of modifying the Logger classes (et. al.) to replace the level with types, with the intention of folding those changes back into the product. But if no one is interested, I'll just make some small mods to Logger for my own purposes and handle it as a one-off type situation. In either case, I intend to move forward with log4j! It has many features which I'm planning to use in the future (like that IMAppender being discussed!!). Mostly its a matter of whether I do a complete implementation to replace levels, or just a quick fix to solve my problems. Thoughts, comments ??? Ceki, as one of the main champions for log4j, do you have any input? --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Separate configs for different webapps
Howdy, Thanks Jake for adding the links: your solution will work, I've tried it myself in the past. That said, I fully agree with Senor Coast's advice to not share jars across webapps, even if they're exactly the same. Keep all the jars for your webapp, including common ones, in WEB-INF/lib. Or just deploy as one WAR file. Webapps are supposed to be self-contained, and you will save yourself many configuration and debugging hassles if you stick to this principle. Yoav Shapira Millennium ChemInformatics -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 1:53 AM To: Log4J Users List Subject: RE: Separate configs for different webapps This should be possible using separate logger repositories per/webapp. Please see: http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppConta iner Logging I've added a link to this in the wiki FAQ as well: http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/Frequent lyAs kedQuestions Jake At 01:50 PM 8/8/2003 -0700, you wrote: Follow on question... Some of my code is shared among several webapps. We've been installing the jar files in the tomcat shared/lib directory. I'd like the log messages from these shared components to use the same logging configuration as the specific webapp that is calling them is using. Essentially things running on a particular thread (and child threads it starts) would use the same log configuration. If I use the solution mentioned (i.e., putting the log4j.jar in the webapp's classes directory), it seems like this will only cause the classes associated with the webapp to use the logging configuration? In other words, won't log calls from the shared jars use a different logging configuration than the webapp methods that are calling them? If this is a problem, then is there a way around it? It seems like I want some type of logging context that I can establish on a thread that defines ALL of the log settings, not just a name. Pat -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List Subject: RE: Separate configs for different webapps Howdy, Yes. Instead of them sharing log4j.jar, put a copy of the jar in each app's WEB-INF/lib folder. Then keep the separate config files as you've done, in each app's WEB-INF/classes folder. Make sure there's no log4j.jar in tomcat's common/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:37 PM To: [EMAIL PROTECTED] Subject: Separate configs for different webapps Hi, I am probably asking a stupid question here because I am new to log4j and tomcat. I have two webapps running under tomcat (single JVM) that are sharing common libraries. I am trying to find a way to set up the logging properties such that the two webapps have different settings (i.e., different appenders, layouts, levels, etc.). I've tried putting a log4j.properties file in the classes directory for each of my webapps, but it seems it only automatically picks up the one associated with whichever webapp is started first by tomcat (the other one is never loaded). If I put an explicit call in both webapps to the PropertyConfigurator, it seems that whichever one loads last overwrites the previous settings. Can I get different settings for each of my webapps somehow? Pat Grever Software Development Engineer iIPS Connectivity - Management Applications Lab Phone: 208.396.2522 Fax: 208.396.4796 [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please
RE: Creating log files relative to the web applications root directory?
Howdy, U, so basically then it is not possible to define a directory path in the log4j.xml properties file so that log files are placed relative to the web apps root directory? Or for that matter relative to any known anchor point like the server root directory? A problem we have is that we deploy .war files by sending the package to the server gods who then drop it into the webapps directory. Alas we don't This is a typical scenario. As Senor Ebersole suggested, you would reach agreement with the server admins on a particular directory or other repository where you can log. You would then use the System property or JNDI approach I illustrated in previous messages in this thread, except they set the property (or setup server.xml for JNDI), not you. Your app should complain and/or use a default setup (BasicConfigurator.configure() for example) if this property is not found. based machine and the production servers are hosted on a flavor of Unix. Hard coding a directory path like C:\..\ may work when doing the dev work under Windows but just don't kind of cut it on a Unix file system when it comes time to deployment. Even if you didn't have a mixed system deployment, hard-coding is a bad idea ;) I would throw out one other type of option for this case: if you control some servers, but not the ones you deploy to, you could have your apps send logging messages to the servers you control, e.g. via a SocketAppender or JMSAppender, or JDBCAppender even. Then you can figure out how to persist the messages yourself. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j: dump wrap-around buffer of all log messages
Howdy, I don't see your point. If you put the logged messages to a circular buffer that holds say 16k messages at a time, then you won't have high memory usage just 16k*size of a logged message. Of course if your code if full of debug logging, then the program will be slow, but on the other hand will give you very valuable feedback in case of an exception/error. 16k times the size of a logged message can be large, first of all. Secondly, that amount might be multiplied many times by having a separate buffer for each logger. Secondly, I like to be able to make the tradeoff of performance versus information myself, i.e. via configuration and reconfiguration at runtime. I will not accept a system that always keeps an extra 16k messages in case there's an error. I'm not saying this feature is a completely bad idea. It can be useful in certain cases. However: - log4j is in a sweet spot performance-wise, and care should be taken to maintain that. - When someone is considering moving to log4j from another package, complaining of the other package's performance, and then asks to add a feature that seems like a performance hog to log4j, that's a red flag for me. I will be glad to be convinced otherwise by a benchmark, however... Yoav Shapira -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 3:29 PM To: Log4J Users List Subject: RE: log4j: dump wrap-around buffer of all log messages Howdy, I would really want this sort of feature benchmarked for memory use ;) Perhaps this is one of the reasons log4j has better performance than your current java trace kit ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:24 AM To: Log4J Users List Subject: Re: log4j: dump wrap-around buffer of all log messages Yes, this is certainly possible. The SMTPAppender works in a similar fashion. At 03:09 PM 8/11/2003 +0200, you wrote: Dear log4j users, Currently I'm evaluating log4j 1.2.8 to replace an other Java Trace package (see http://visibleworkings.com/trace/) in our applications. Log4j's big advantage is its performance, but still I'm missing a feature that is present in the Java Trace package: the ability to dump a wrap-around buffer of, let's say, the last 500 log messages in the log file. The wrap-around buffer (think of it as an array of let's say 500 log messages) contains at any moment, the last 500 log messages. The idea is that the logger has 2 log levels: one which determines what level is present in the log file (or std out or whatever), another which determines at what level the internal wrap-around buffer is filled with messages. This way, it is possible to let your application log at level INFO, while the internal buffer keeps all messages of level DEBUG or higher. When an exception is thrown, the user should have the ability to request a dump of the buffer, such that the more detailed DEBUG messages are also present in the log file to make debugging more easy. Is this possible in log4j? If not, has anyone a workaround for this or should I ask for a feature request? Kind regards, Patrick Hancke Siemens Atea IC D BS PD2 tel ++32(0)14 - 25 24 27 fax ++32(0)14 - 25 30 25 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended
RE: Newbie how to place logfile under tomcat logs
Howdy, Thanks, thats a help but because of the setup of our application, I cant use the first two options, and I'd rather not define another properties file just to store ${CATALINA_HOME}/logs/logs.txt. Is there any way I can do it programatically? What are the other options? No. It would be against the spirit, if not the letter, or the servlet specification for a servlet to be able to find out such details about its container. Even the approaches I showed before weren't that portable. This is like those perennial how can I find out what port the server is running on in my servlet's init() method? (You can't with certainty/portability). Other options include adding a JNDI entry for your log file path into tomcat's server.xml and then doing a JNDI lookup in your servlet's init method, or mangling your log4j configuration together with tomcat's commons-logging configuration. The latter is just cruising for a bruising, and the former is too container-specific (requires modifying server.xml) for my preferences, so I didn't include them before. Typically the Ant option is the one I like best, but I guess you don't use Any to deploy/package your application? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating log files relative to the web applications root directory?
Howdy, I suppose Adrian could be a woman's name as well, so you're right ;) AmendedVersion But if you're the server admin, you're king (or queen) ;) /AmendedVersion Yoav Shapira Millennium ChemInformatics -Original Message- From: Caroline Wood [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:13 AM To: 'Log4J Users List' Subject: RE: Creating log files relative to the web applications root directory? or Queen! lol ;) -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 11 August 2003 14:05 To: Log4J Users List; [EMAIL PROTECTED] Subject: RE: Creating log files relative to the web applications root directory? Howdy, What I've seen done to achieve this is have my ant deployment script fill the value when copying log4j.xml over. So in log4j.xml, you'd have param name=File value=@logFilePath@ / And in your ant script, you set filtering=true when copying log4j.xml, and replac the logFilePath token with the actual (absolute) path. As an aside, note that the servlet container is not required to give you write access under your webapp's root. In fact, many server admins dislike this, as they prefer a centralized log location for their systems. But if you're the server admin, you're king ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Adrian Beech [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 6:42 AM To: 'Log4J Users List' Subject: Creating log files relative to the web applications root directory? G'day, Is it possible to specify a log filename in the XML log4j properties file so that it is relative to the web applications root directory? I have the following in a log4j.xml file located in web-inf/classes with the log4j jar in the web-inf/lib directory. Logging seems to be fine except the rascal.log file is being created in the Tomcat application directory under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory tree. I'd prefer to have the log files in something like ../webapps/application/logs/logfilename. Is this possible? BTW, took a while to find the rascal.log file!!! --[log4j.xml]- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=rf class=org.apache.log4j.RollingFileAppender param name=file value=rascal.log/ param name=maxBackupIndex value=2/ param name=maxFileSize value=250KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{dd/MM/ HH:mm:ss} %-5p (%t) %l - %m%n/ /layout /appender root priority value=debug / appender-ref ref=rf/ /root /log4j:configuration --[End Of File]--- I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and Tomcat 4.1.24 on a Unix box as the production platform. AB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ _ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ___ _ This is an email from The CPP Group, Holgate Park, York, YO26 4GA; telephone 01904 544500. This message may contain information that is confidential. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify the sender immediately by email, facsimile or telephone and either return or destroy the original message. The CPP Group accept no responsibility for any changes made to this message after it has been sent by the original author. ___ _ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com
RE: calling DOMConfigurator.configureAndWatch() 2 times
Howdy, What should happen if the configureAndWatch() function is called twice? Are the previous settings erased? Are they accumulated ? It wouldn't be that hard to simply test this and see what happens ;) But looking at the code, you see: - configureAndWatch always creates a new XMLWatchdog, so you will have two XMLWatchdogs watching over the file. - Each XMLWatchdog would call DOMConfigurator#doConfigure(filename, repository) when the file changes, so this method will get called twice. So this is extra overhead that should be avoided if possible. - The configuration file will get parsed again with a new parser - Parsing will replace where found and add where not found. So if there's already a logger for class, for example, it will be retrieved if it exists and reconfigured, or a new one will be created if one doesn't exist. You can walk through the rest of DOMConfigurator if you feel like it ;) This is one issue where the test is easy so I wouldn't even spend time looking at the code ;) Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j: dump wrap-around buffer of all log messages
Howdy, I would really want this sort of feature benchmarked for memory use ;) Perhaps this is one of the reasons log4j has better performance than your current java trace kit ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:24 AM To: Log4J Users List Subject: Re: log4j: dump wrap-around buffer of all log messages Yes, this is certainly possible. The SMTPAppender works in a similar fashion. At 03:09 PM 8/11/2003 +0200, you wrote: Dear log4j users, Currently I'm evaluating log4j 1.2.8 to replace an other Java Trace package (see http://visibleworkings.com/trace/) in our applications. Log4j's big advantage is its performance, but still I'm missing a feature that is present in the Java Trace package: the ability to dump a wrap-around buffer of, let's say, the last 500 log messages in the log file. The wrap-around buffer (think of it as an array of let's say 500 log messages) contains at any moment, the last 500 log messages. The idea is that the logger has 2 log levels: one which determines what level is present in the log file (or std out or whatever), another which determines at what level the internal wrap-around buffer is filled with messages. This way, it is possible to let your application log at level INFO, while the internal buffer keeps all messages of level DEBUG or higher. When an exception is thrown, the user should have the ability to request a dump of the buffer, such that the more detailed DEBUG messages are also present in the log file to make debugging more easy. Is this possible in log4j? If not, has anyone a workaround for this or should I ask for a feature request? Kind regards, Patrick Hancke Siemens Atea IC D BS PD2 tel ++32(0)14 - 25 24 27 fax ++32(0)14 - 25 30 25 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie how to place logfile under tomcat logs
Howdy, this may be more a tomcat question so appologies if it is off-topic. I want to plcae the log file under %TOMCAT_HOME%\logs (where all the tomcat logs go). Reading the archives of this list or the tomcat-user list would've revealed answers, as this is a fairly common question. I have defined in web.xml: servlet servlet-nameMyServlet/servlet-name servlet-classfoo.bar.MyServlet/servlet-class init-param param-namelogfile/param-name param-valuelogs.txt/param-value /init-param /servlet and in the servlet: String logFile = getInitParameter(logfile); appender = new FileAppender(layout, logFile); You have a number of options, including: - Setting param-value in web.xml to be an ant token, e.g. param-value@logFilePath@/param-value and have Ant fill in this token from whatever properly you want, e.g. $CATALINA_HOME/logs/logs.txt, when it's deploying web.xml. - Adding -DCATALINA_HOME=$CATALINA_HOME to your JAVA_OPTS in $CATALINA_HOME/bin/catalina.sh so that you can get Catalina home via System.getProperty(), then do String logFile = System.getProperty(CATALINA_HOME) + /logs/ + getInitParameter(logFile); - Using a log4j configuration file, rather than programmatic configuration, and having something like log4j.myAppender=org.apache.log4j.FileAppender log4j.myAppneder.File=${CATALINA_HOME}/logs/logs.txt ... There are other options as well. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]