RE: OutOfMemoryError using Log4J
Hi, Re-calling Configurator.configure() each time to make a change is inefficient. Instead, either: - Configure with a watchdog, i.e. configureAndWatch(). - Have a servlet, JSP, or whatever fits your framework, where the user can input a logger name (package or class name, doesn't matter), and a logging level. On submission of that information, just do String loggerName = [from user submission] String loggingLevel = [from user submission] Logger selectedLogger = Logger.getLogger(loggerName); selectedLogger.setLevel(Level.toLevel(loggingLevel)); And that's it. Yoav Shapira Millennium ChemInformatics -Original Message- From: Joe Consumer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 5:26 PM To: [EMAIL PROTECTED] Subject: OutOfMemoryError using Log4J Hi, We're using Log4J and we are trying to re initialize Log4J after a user has made some configuration changes. More to the point, we want to be able to change the log priority so we can turn on debug tracing without restarting our program. We are able to turn Debugging to so lesser priority (like ERROR or FATAL), but when we go the other way we get an OutOfMemoryException when we make the call: PropertyConfigurator.configure(props); Please help. We can't really seem to debug this since the stacktrace is blank. Is there something we need to call in addition to this call? Do we have to use the file monitoring stuff? charlie __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Line numbers and method name of calling class
Hi, Does anyone know a way to fix this?? Don't use a wrapper ;) Chances you're just reducing performance and adding a layer or complexity for not much of a win. Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: log4j messages to String conversion?
Hi, Perhaps you could configure log4j to use different / additional appenders to help your task. The console is annoying. A file appender would write to a file, and you could then stream the contents of the file over RMI in whatever chunks fits your system. A socket appender could write directly to the network port you want. A JMS appender would send stuff to a JMS queue, and the process on the other side could read it... Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Hopmann [mailto:hopmann;c-lab.de] Sent: Friday, November 08, 2002 10:16 AM To: Log4J Users List Subject: Re: log4j messages to String conversion? Hi, I just want to send the completely formatted string (like: '0 [main] com.foo.bar - this is the message') via an RMI connection, that is already implemented and must be used... My problem is, that the output string is only send to the console and I am not able to convert it to a String, to use it in my program. Regards, Dirk Hopmann - Original Message - From: Ricardo Moral [EMAIL PROTECTED] To: Log4J Users List [EMAIL PROTECTED] Sent: Friday, November 08, 2002 3:56 PM Subject: Re: log4j messages to String conversion? What do u need? The formatted event message? What do u need this for? --- Dirk [EMAIL PROTECTED] wrote: Hi, my question is, whether it is possible to get the output string of a method-call like this: logger.debug(message). I would like to send that String (which is perfectly outputted on my console) over an RMI connection. Thanx a lot, Dirk Hopmann -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: How to configure SMTPAppender?
Howdy, The email happens automatically ;) What is the point of SMTPAppender otherwise? It hides all the javax.mail details from you. Yoav Shapira Millennium ChemInformatics -Original Message- From: Adams, Dick W [PCS] [mailto:DAdams07;sprintspectrum.com] Sent: Friday, November 08, 2002 12:35 PM To: 'Log4J Users List' Subject: RE: How to configure SMTPAppender? Does the e-mail then happen automatically, or does one have to extend SMTPAppender? -Original Message- From: Sara Prigge [mailto:sprigge;LTCG.com] Sent: Friday, November 08, 2002 11:32 AM To: 'Log4J Users List' Subject: RE: How to configure SMTPAppender? This is how I use it in my xml: appender name=email class=org.apache.log4j.net.SMTPAppender param name=Threshold value=ERROR/ param name=SMTPHost value=99.9.9.9/ param name=To value=[EMAIL PROTECTED]/ param name=From value=[EMAIL PROTECTED]/ param name=Subject value=My email subject/ param name=BufferSize value=1/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ABSOLUTE} (%F:%L) - %m%n/ /layout /appender Hope that helps you! -Original Message- From: louis [mailto:louis;allsofts.com] Sent: Friday, November 08, 2002 11:30 AM To: Log4J Users List Subject: How to configure SMTPAppender? Hello, I want to configure SMTPAppender in my log4j.xml file, and anyone tell me what is the syntax (tag)? I can't find any document talking about the log4j xml structure. Regards, Louis -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: How to configure SMTPAppender?
Hi, Do you get any error messages anywhere? Do you see the messages you're trying to email on other appenders, e.g. a file somewhere? Yoav Shapira Millennium ChemInformatics -Original Message- From: louis [mailto:louis;allsofts.com] Sent: Friday, November 08, 2002 12:46 PM To: Log4J Users List Subject: Re: How to configure SMTPAppender? Thanks Sara, I try set the Threshold to DEBUG for testing, but I don't know I still can't receive any email. regards, Louis - Original Message - From: Sara Prigge [EMAIL PROTECTED] To: 'Log4J Users List' [EMAIL PROTECTED] Sent: Friday, November 08, 2002 5:37 PM Subject: RE: How to configure SMTPAppender? The way I use it, it happens automatically when I log something at the ERROR level or above. -Original Message- From: Adams, Dick W [PCS] [mailto:DAdams07;sprintspectrum.com] Sent: Friday, November 08, 2002 11:35 AM To: 'Log4J Users List' Subject: RE: How to configure SMTPAppender? Does the e-mail then happen automatically, or does one have to extend SMTPAppender? -Original Message- From: Sara Prigge [mailto:sprigge;LTCG.com] Sent: Friday, November 08, 2002 11:32 AM To: 'Log4J Users List' Subject: RE: How to configure SMTPAppender? This is how I use it in my xml: appender name=email class=org.apache.log4j.net.SMTPAppender param name=Threshold value=ERROR/ param name=SMTPHost value=99.9.9.9/ param name=To value=[EMAIL PROTECTED]/ param name=From value=[EMAIL PROTECTED]/ param name=Subject value=My email subject/ param name=BufferSize value=1/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ABSOLUTE} (%F:%L) - %m%n/ /layout /appender Hope that helps you! -Original Message- From: louis [mailto:louis;allsofts.com] Sent: Friday, November 08, 2002 11:30 AM To: Log4J Users List Subject: How to configure SMTPAppender? Hello, I want to configure SMTPAppender in my log4j.xml file, and anyone tell me what is the syntax (tag)? I can't find any document talking about the log4j xml structure. Regards, Louis -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: Is configureAndWatch unique to Log4j?
Hi, No for logging. You have to use java.util.logging.LogManager.readConfiguration() or readConfiguration(InputStream ins) yourself when you want the configuration re-read. If you want automatic re-reading you have to create and start a Thread subclass yourself. FileWatchdog is not part of the JDK as far as I remember. There are free implementations available. Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:Daniel.Hannum;smed.com] Sent: Thursday, November 07, 2002 1:13 PM To: Log4J Users List Subject: Is configureAndWatch unique to Log4j? I apologize for being off-topic. I'm not well-versed in Java's built-in configuration mechanisms, and I don't want to take the time to figure it all out for one simple question: Is dynamic configuration (akin to configureAndWatch) available in JDK 1.4 logging? I'd rather use Log4j, but I need to know about the capabilities of the competition. I would assume that Java 1.4 provides some kind of built-in class roughly the same as FileWatchdog. If a Java expert could give a quick yes/no, that would be great. Thanks. Daniel Hannum --- This message and any included attachments are from Siemens Medical Solutions Health Services Corporation 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: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: Specifying default configuration file for Tomcat
Hi, You're specifying the path to a file. Use the File.separator for your system. On Unix, that / normally, and on windows \. Yoav Shapira Millennium ChemInformatics -Original Message- From: Bradley M. Handy [mailto:bhandy;arbor.edu] Sent: Friday, November 01, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: Specifying default configuration file for Tomcat I've read the short manual, and I've seen how to specify the default configuration file when starting Tomcat. However, I was wondering if my configuration file is a couple of directory levels down from WEB- INF/classes, which notation should I use: Dot notation: dir1.dir2.config-file.properties Slash notation: dir/dir2/config-file.properties (Unix) dir1\dir2\config-file.properties (Windows) Could someone please enlighten me? Thanks. Bradley M. Handy Programmer/Analyst Spring Arbor University mailto:bhandy;arbor.edu -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: JRun4, WebLogic 7.0 Log4J bufferedIO exception
Hi, Could it be that weblogic somewhere has another log4j jar whose version conflicts with yours? Check all the directories from which weblogic might load classes for versions of log4j. Don't forget various server and JDK endorsed directories. Yoav Shapira Millennium ChemInformatics -Original Message- From: Mitch Christensen [mailto:mitch.christensen;informatixinc.com] Sent: Wednesday, October 30, 2002 11:27 AM To: [EMAIL PROTECTED] Cc: Mitchell Christensen Subject: JRun4, WebLogic 7.0 Log4J bufferedIO exception Hi, I came across the attached message (way below) in the archive regarding rollover exceptions w/ WebLogic 7.0. As it turns out, I'm getting the *exact* same exception using Log4J (log4j-1.2.6.jar) with JRun4 (running a Turbine 2.2b3 webapp). Rakesh's statement appears to be correct, the exception states that the field 'bufferedIO' doesn't exist. However, looking at the Log4J-1.2.6 source, it is there. To me, this implies a jar version mismatch. However, I can't find the conflict. We've been living with this bug for a couple of weeks, and QA is starting to ride my pretty closely. Everything works fine until the log file rolls over for the first time, then the exception is thrown, and the only cure is to shut down JRun4, delete the log file, and restart JRun4. This is livable in development, but as we step up usage in QA, the log file fills quickly. I should also note that I've seen other, similar exceptions thrown as well, but I don't have stack traces from those handy. These 'other' exceptions also occassionally point to a version problem. Things like '...method not found', etc. These are more sporadic, and may be totally unrelated. *ANY* help would be greatly appreciated. Even if you might have analysis/debugging strategies that might help. I'm running out of ideas. Thanks in advance. -Mitch PS Not to belabor a simple request, but I've included a list of the .jar files from my WEB-INF/lib in case anyone sees anything obvious. --My Stack Trace--- [Wed Oct 30 07:32:59 PST 2002] -- ERROR -- Exception: java.lang.NoSuchFieldError: bufferedIO Stack Trace follows: java.lang.NoSuchFieldError: bufferedIO at org.apache.log4j.RollingFileAppender.rollOver(RollingFileAppender.java:1 45) at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java: 228) at org.apache.log4j.WriterAppender.append(WriterAppender.java:157) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(Ap penderAttachableImpl.java:57) at org.apache.log4j.Category.callAppenders(Category.java:255) at org.apache.log4j.Category.forcedLog(Category.java:445) at org.apache.log4j.Category.info(Category.java:704) at org.apache.velocity.runtime.log.SimpleLog4JLogSystem.logVelocityMessage( SimpleLog4JLogSystem.java:175) at org.apache.velocity.runtime.RuntimeInstance.log(RuntimeInstance.java:914 ) at org.apache.velocity.runtime.RuntimeInstance.info(RuntimeInstance.java:93 4) at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Re sourceManagerImpl.java:479) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Res ourceManagerImpl.java:384) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance. java:814) at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleto n.java:355) at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:482) at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:461) at org.apache.turbine.services.velocity.TurbineVelocityService.decodeReques t(TurbineVelocityService.java:384) at org.apache.turbine.services.velocity.TurbineVelocityService.handleReques t(TurbineVelocityService.java:278) at org.apache.turbine.services.velocity.TurbineVelocity.handleRequest(Turbi neVelocity.java:107) at org.apache.turbine.modules.navigations.VelocityNavigation.buildTemplate( VelocityNavigation.java:132) at org.apache.turbine.modules.navigations.TemplateNavigation.doBuild(Templa teNavigation.java:103) at org.apache.turbine.modules.Navigation.build(Navigation.java:98) at org.apache.turbine.modules.NavigationLoader.eval(NavigationLoader.java:1 29) at org.apache.turbine.util.template.TemplateNavigation.toString(TemplateNav igation.java:125) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference .java:321) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.jav a:271) at org.apache.velocity.Template.merge(Template.java:296) at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:492) at
RE: JRun4, WebLogic 7.0 Log4J bufferedIO exception
Hi, Unfortunately, I usually have to resort to more basic techniques like jar tvf some.jar | grep somePackage for example jar tvf weblogic.jar | grep log4j I've found many an unexpected duplicate class that way, especially for the XML APIs. ;( Yoav Shapira Millennium ChemInformatics -Original Message- From: Mitch Christensen [mailto:mitch.christensen;informatixinc.com] Sent: Wednesday, October 30, 2002 11:49 AM To: Log4J Users List Subject: RE: JRun4, WebLogic 7.0 Log4J bufferedIO exception I think this may in fact be the case, but there doesn't appear to be another log4j*.jar anywhere on my disk. Does anyone have any toos/techniques for identifying where a particular class (in this case org.apache.log4j.RollingFileAppender) loads from? I've tried the java -verbose/-verbose:class parameter to the server startup command, which provides lots of information about the *order* in which classes are loaded, but not the source of the class (.jar file/etc.). -Mitch -Original Message- From: Shapira, Yoav [mailto:Yoav.Shapira;mpi.com] Sent: Wednesday, October 30, 2002 8:35 AM To: Log4J Users List Subject: RE: JRun4, WebLogic 7.0 Log4J bufferedIO exception Hi, Could it be that weblogic somewhere has another log4j jar whose version conflicts with yours? Check all the directories from which weblogic might load classes for versions of log4j. Don't forget various server and JDK endorsed directories. Yoav Shapira Millennium ChemInformatics -Original Message- From: Mitch Christensen [mailto:mitch.christensen;informatixinc.com] Sent: Wednesday, October 30, 2002 11:27 AM To: [EMAIL PROTECTED] Cc: Mitchell Christensen Subject: JRun4, WebLogic 7.0 Log4J bufferedIO exception Hi, I came across the attached message (way below) in the archive regarding rollover exceptions w/ WebLogic 7.0. As it turns out, I'm getting the *exact* same exception using Log4J (log4j-1.2.6.jar) with JRun4 (running a Turbine 2.2b3 webapp). Rakesh's statement appears to be correct, the exception states that the field 'bufferedIO' doesn't exist. However, looking at the Log4J-1.2.6 source, it is there. To me, this implies a jar version mismatch. However, I can't find the conflict. We've been living with this bug for a couple of weeks, and QA is starting to ride my pretty closely. Everything works fine until the log file rolls over for the first time, then the exception is thrown, and the only cure is to shut down JRun4, delete the log file, and restart JRun4. This is livable in development, but as we step up usage in QA, the log file fills quickly. I should also note that I've seen other, similar exceptions thrown as well, but I don't have stack traces from those handy. These 'other' exceptions also occassionally point to a version problem. Things like '...method not found', etc. These are more sporadic, and may be totally unrelated. *ANY* help would be greatly appreciated. Even if you might have analysis/debugging strategies that might help. I'm running out of ideas. Thanks in advance. -Mitch PS Not to belabor a simple request, but I've included a list of the .jar files from my WEB-INF/lib in case anyone sees anything obvious. --My Stack Trace-- - [Wed Oct 30 07:32:59 PST 2002] -- ERROR -- Exception: java.lang.NoSuchFieldError: bufferedIO Stack Trace follows: java.lang.NoSuchFieldError: bufferedIO at org.apache.log4j.RollingFileAppender.rollOver(RollingFileAppender.java: 1 45) at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java : 228) at org.apache.log4j.WriterAppender.append(WriterAppender.java:157) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(A p penderAttachableImpl.java:57) at org.apache.log4j.Category.callAppenders(Category.java:255) at org.apache.log4j.Category.forcedLog(Category.java:445) at org.apache.log4j.Category.info(Category.java:704) at org.apache.velocity.runtime.log.SimpleLog4JLogSystem.logVelocityMessage ( SimpleLog4JLogSystem.java:175) at org.apache.velocity.runtime.RuntimeInstance.log(RuntimeInstance.java:91 4 ) at org.apache.velocity.runtime.RuntimeInstance.info(RuntimeInstance.java:9 3 4) at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(R e sourceManagerImpl.java:479) at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Re s ourceManagerImpl.java:384) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance . java:814) at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSinglet o n.java:355) at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:482) at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:461
RE: log4j MDC in Weblogic 6.1 server
Hi, Why don't you have different appenders for each application, e.g. a FileAppender, where the log file's name corresponds to the application name? Yoav Shapira Millennium ChemInformatics -Original Message- From: Follender, Ivan [mailto:Ivan.Follender;hbo.com] Sent: Monday, October 28, 2002 2:43 PM To: '[EMAIL PROTECTED]' Subject: log4j MDC in Weblogic 6.1 server Hi- I have multiple applications (EARs) running in a Weblogic 6.1 server. I want the log message for each application to be 'stamped' with the name of the application. I am using a log4j ConsoleAppender to log all messages for all applications to the Console. I tried using the the Message Diagnostic Context (MDC), but the threads for a particular application in Weblogic do not necessarily appear to be from a single thread lineage. So when I put something in the MDC in one application thread, it is not necessarily there in a later thread. Any recommendations on how to stamp each message with the application name? Thanks, ivan. === === This e-mail is intended only for the use of the addressees. Any copying, forwarding, printing or other use of this e-mail by persons other than the addressees is not authorized. This e-mail may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, please notify us immediately by return e-mail (including the original message in your reply) and then delete and discard all copies of the e-mail. Thank you. -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: Log4j: Using servlet to init, but how to reload???
Hi, servlet servlet-nameLog4jInit/servlet-name servlet-classLog4jInit/servlet-class init-param param-namelog4j-init-file/param-name param-valueWEB-INF/log4j.config/param-value /init-param load-on-startup1/load-on-startup /servlet Just keep in mind that the server is not required to keep load-on-startup servlets in memory. It may destroy and deallocate them at anytime, so the destroy() method of your init servlet is NOT a safe place to do things like LogManager.shutdown(). A ServletContextListener would be a better choice for the above code. This works fine, however, any changes made to log4j.config do not take effect until the server is restarted. Is the something I can code or something I can configure to change this? Did you try PropertyConfigurator.configureAndWatch()? Then when you change the file, log4j will pick it up automatically. In addition, it is easy to write a page that will accept a logger name and a logging level and set that logger to that level at runtime. If you think this approach would be useful for you and need more information, let us know. 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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: logging by concurrent threads
Hi, can anyone tell me if Log4J guarantees that logging by several concurrent threads is sequentially correct? Are there specific conditions to be kept? This is a question for Ceki, but I think the answer is no. Log4j can't guarantee it. Even theoretically, I see this as a problem. Instead, did you consider using NDC or MDC to output the thread identification information? 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: mailto:log4j-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:log4j-user-help;jakarta.apache.org
RE: How to get PrintStream of an Appender?
Hi, We are using a third-party tool where its debugger only has the method 'getDebugStream(PrintStream s)' to config its debug io stream. OK. We want to use log4j, which means we need to pass the streams associated with an Appender (file or socket appender). Can this be done and how to get the stream of an Appender? I'm not sure how you would this. There are several reasons against this. One reason, for example, is that log4j is thread safe, and if it exposes its streams for manipulation by other components, they might lock the streams, hence potentially locking log4j. Another reason is that log4j conceptually doesn't want you to concern yourself with streams per-se, only loggers, appenders, and the like. Perhaps a solution to your problem would be: set your 3rd party tool print stream to System.out or System.err, then configure a log4j console appender to grab messages headed to System.out and/or System.err. This extra level of redirection, while slowing down logging, will keep your 3rd party tool and log4j both happy and decoupled. 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Performance between Log4j and custom in-house logger
Are there any plans to re-write log4j (any next generation version). It seems that log4j needs an architectural change rather than anything else. I wouldn't jump the gun if I were you. :-) Hi, Though you have to love it when someone uses a mature, popular system for a few days, then promptly claims his/her system is better and (instead of just using his/her) demands a rewrite of the other system ;) I find it amusing ;) 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Performance between Log4j and custom in-house logger
Hi, There are always going to be difference between any two systems designed to do the same thing. Your system was obviously designed for your needs, and probably not much more. Log4j is designed to be generic, useful to a very broad range of people / applications, easily extensible, and yet fast. At my organization, we carefully compared five or six in-house custom logging systems and a couple of 3rd party ones. We included very detailed performance comparisons and profilings. We found log4j to be as fast or faster than nearly all the other implementation, while providing the best range of features. As we need a lot of its features (JDBC logging, SMTP logging, runtime configurability, JMS logging, daily rolling, appender thresholds, object renderers, etc), we picked log4j, and have been very very happy since. So it's a question of what you need from your logging system. If your system did everything you need, you probably wouldn't even be considering log4j, right? ;) Maybe it';; easier to add just the features you need to your own system, instead of migrating to log4j completely? The point is, if you want to help tune log4j you're welcome to. It's open source and contributors are always welcome, right Ceki? ;) However, having used log4j in numerous apps from very small to very large, we've never had any complaints about its performance. There was always a lot of tuning to be done on our own apps before logging performance showed up as a blip on the profiler screen... Yoav Shapira Millennium ChemInformatics -Original Message- From: sk k [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 03, 2002 10:30 AM To: [EMAIL PROTECTED] Subject: Performance between Log4j and custom in-house logger Hi, We are planning to move from a custom in house logging framework (MyLogger) to using Log4j and have been doing some performance comparison between log4j and MyLogger. The numbers seem to be favoring mylogger over log4j. Sample Numbers == Note: Timing includes logj startup time, mylogger startup time and junitperf startup time. 1) Logging 2 strings, each of size: 128bytes Request MyLogger(sec) Log4j(sec) == === = 1001.221.29 1000 1.671.71 2000 2.122.01 2) Logging 4 strings, each of size: 128bytes Request MyLogger(sec) Log4j(sec) == === = 1001.211.25 1000 1.653 1.82 2000 2.242.56 3) Logging 8 strings, each of size: 128bytes Request MyLogger(sec) Log4j(sec) == === = 1001.351.35 4001.561.71 9001.8 2.35 4) Logging 80 strings, each of size: 128bytes Request MyLogger(sec) Log4j(sec) == === = 1001.251 1.7 1000 1.816.1 2000 2.1511.2 Sample code and configuration === log4j.properties == log4j.rootCategory=DEBUG,dest1 log4j.appender.dest1=org.apache.log4j.RollingFileAppender log4j.appender.dest1.layout=org.apache.log4j.SimpleLayout log4j.appender.dest1.File=c:/skk/cps/logger/test/test1.log log4j.appender.dest1.MaxFileSize=4MB log4j.appender.dest1.MaxBackupIndex=60 log4j.category.ut.log.Log4jPerfTest=DEBUG,dest2 log4j.additivity.Log4jPerfTest=false log4j.appender.dest2=org.apache.log4j.RollingFileAppender log4j.appender.dest1.layout=org.apache.log4j.TTCCLayout log4j.appender.dest2.File=c:/skk/cps/logger/test/test.log log4j.appender.dest2.MaxFileSize=4MB log4j.appender.dest2.MaxBackupIndex=60 Test Logger code === Note: logMsgs is an array with strings of size 128 bytes. public void test_Log4j() throws Exception { int size = logMsgs.size(); for( int i=0; isize; i++ ) { log4jLogger.info( (String)logMsgs.get(i) ); } } Some of my questions 1) Is there anything that I can do to increase the performance of log4j on my box( Pentium-3, 800Mhz, 512MB RAM) 2) I see some architectural difference between the way mylogger and log4j is implemented namely My logger does formattingwriting to log file in a background thread whereas it seems that log4j doesn't seem do the same. Is this true. My logger uses the concept of observer and observable. Thanks. __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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:
RE: pure java log4j
Hi, If you don't need to use the NTEventLogAppender, you don't need the DLL. I'd say we use a lot of the features of log4j in production, and we only use pure java... Yoav Shapira Millennium ChemInformatics -Original Message- From: Madhav Inamti [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 27, 2002 8:20 PM To: 'Log4j-User ([EMAIL PROTECTED]) Subject: pure java log4j Is there a version of log4j that is pure java. For e.g., the NTEventLogAppender requires a DLL. Is there a version that does not require any shared libraries / dll's ? Thanks, Madhav 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logging idioms or guidelines: anyone have some?
Hi, What you do, be consistent ;) That'll make it easier to understand and refactor later if necessary. Other than that, it's a matter of style. Sometimes it's a matter of personal style, sometimes organizational guidelines. There's an ISO standard somewhere about this, but I don't remember off the top of my head. For example, do you log just before you do something: logger.debug(connecting to the database); or after logger.debug(connected to the database); or both? Both, if it's a significant operation. Also for DEBUG-level statements, I always use logger.isDebugEnabled() around them for performance. It makes a big difference on large systems. Do you log when you throw an exception, catch one, or both? Both, on the principal that exceptions are serious things and you want to have caller (or thrower) as well as receiver (catcher) logging for them. There've been numerous times that I found having both logged together gives me significant context information for the exception. Preachers of aspect oriented programming might not mind seeing a logging statement at the entry and exit of every method. Some would certainly find this to be overkill. Overkill. But then again I'm very performance oriented. Like I said, it's a matter of style. The above are just IMHO. 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logger serializable?
Hi, Much like are my beloved Patriots going to win the SuperBowl again?, the answer to your question is almost definitely no. Logger is not serializable. You can easily and quickly tell that from the JavaDoc, at: http://jakarta.apache.org/log4j/docs/api/index.html (class Logger or an ancestor would have to implement java.io.Serializable and I don't think it does). Your use-case is interesting. Why did you want to put the loggers into JNDI? Yoav Shapira Millennium ChemInformatics -Original Message- From: Ryan Cuprak [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 11:26 AM To: Log4J Users List Subject: Logger serializable? Just out of curiosity - are loggers serializable? In other words, can they be safely put into jndi? I was going to setup the loggers for my EJBs in Mbeans and put the loggers into jndi (using jboss). -Ryan --- --- Ryan Cuprak Software Developer Eastman Kodak www.cuprak.net Cell: (203)-376-8789 [EMAIL PROTECTED]Office: (203)-786-5682 [EMAIL PROTECTED] Home: (203)-407-8267 AIM: rcupr --- --- -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logger serializable?
Hi, but I am trying to keep my EJBs pure so that I would not be tied to one app server (actually a constraint on my project). I also wanted to manage the logging via mbeans. Right now I don't see any clear way to use log4j in enterprise beans and easily manage the logging at run time. Here's what we do: - Obtain loggers in the simplest way: Logger.getLogger(Foo.class.getName()); - Use loggers normally within the beans. - We wrote a simple servlet that lets you name a package / class and set the logging level for it. This servlet is really very simple and easy to write. Only two form fields (class name and logging level) and a submit button for the UI. Very simple logger = Logger.getLogger(whatever was specified in the class name field) and logger.setLevel(whatever was specified in the level field). This has worked for us for runtime changes in tomcat standalone, JBoss-tomcat, and JBoss-Jetty, without any container problems (because of course this approach is container-independent). I think the MBean is a nice solution as well, but it may be a bit harder to implement. We also didn't want to tie ourselves to a container that supports JMX, because at the time we developed this JMX support wasn't to be taken for granted ;) Maybe it will work for you too. Good luck, 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: New Level?
Hi, Every now and then there's a use-case where the logging statements seem to almost-but-not-quite fit any of the established levels. There are conceptually two approaches: - Create your own level - Use an existing level Creating your own level is possible in log4j. The downside is that you start using non-standard functionality and it's up to you to maintain it. While the log4j team makes every effort is made to stay backwards compatible, any non-standard part you add to your system requires at least more testing, if not coding, when moving to a new release of log4j. Using an existing level is very easy technically. However, you have to adjust your mental perception of what's DEBUG, as well as your coding practices. And by your, it could be a whole group of developers, not just one, so this is not always an easy change. IMHO, it's definitely paid off to use an existing level, DEBUG. I'm happy about not using custom levels. TRACE, anyone? ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 20, 2002 10:54 AM To: [EMAIL PROTECTED] Subject: New Level? I'm working on a project where I'm implementing a 3rd party proprietary/(mostly undocumented) network protocol. One of my logging statements dumps each byte as it's received/sent over the network. This is used in the direst debugging situations, and can obviously generate a very large number of logging events. (90% or more of the data is just encoded character data, and I also debug each character as it's decoded, so I get alot of events here as well.) These statements have the level of DEBUG, but I think these situations warrant a new Level. Say DEBUG_PEDANTIC. Basically this Level could be used in situations where the statement is a debug statement by definition, but it's called such a HUGE amount of times, and carries so little information, that it's only used in special/rare circumstances. Does this make any sense to add to log4j permanently? Does anyone else have a use for it? Or should I just add it myself to my own copy and use it privately? Thanks. -Mark -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: New Level?
Hi, The upshot of this is the ability to dynamically change the level of debug messages being viewed. Chainsaw is great for this with log4j. But that's besides the point. The reason I like the TRACE level as a standard is not because of the above. It's because commons-logging expects it and JDK logging has it (as FINE). I think the JDK logging levels of FINE, FINER, FINEST in addition to the normal levels are completely overkill. But one TRACE level is a good option to have. I don't really agree with your use case though. You said you find yourself having to add more detailed debug statements and then comment them out. This is design-time and compile-time stuff. Would it be accurate to say you only leave the real DEBUG-level statements in the code when you ship to production? A big advantage of log4j is its small footprint and high speed. The introduction of finer logging levels as part of the standard distribution will encourage people to use these levels more. That in turn will lead to slower run-time performance of these systems in production, unless you are careful to take out all the TRACE-level statements before shipping the product. And if you have to take out all the TRACE-level statements before shipping, what use are they? ;) I think the idea is if someone wants to really log things at a very fine level, like the original poster in this thread, then they have to go through some effort because this logging will slow down the system and that's not something the log4j architects want to encourage... 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to define custome log level?
Hi, One possible way would be to pick two of the standard log4j levels and use only those two. For example, DEBUG for verbose and WARN for standard. You can then easily configure separate appenders for the two levels, etc. Yoav Shapira Millennium ChemInformatics -Original Message- From: Narayanan, Shiva (MED, Compuware) [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 12:24 PM To: [EMAIL PROTECTED] Subject: How to define custome log level? Hello All, We would like to use just two logging levels in our project (namely standard and verbose). We don't want to use the exisiting levels(ALL, DEBUG, ERROR, FATAL, INFO, OFF and WARN).How do we achieve this? Do we have to subclass org.apache.log4j.Level class? Thanks, Shiva -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Antwort: RE: How to view log remotely using log4j
Hi, Did you try Chainsaw? It's great for this purpose! Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:Ulrich.Kleeberger@witt- weiden.de] Sent: Friday, August 16, 2002 3:32 AM To: Log4J Users List Subject: Antwort: RE: How to view log remotely using log4j i think you can use the TelnetAppender. attach it to the category from which you like to see the logging. with any telnet client you can connect to the server and see logging in real time. YingLCS@netsc ape.net An: [EMAIL PROTECTED], [EMAIL PROTECTED] Kopie: 15.08.02 Thema: RE: How to view log remotely using log4j 22:33 Bitte antworten an Log4J Users List I would like to add I want to view the log in real-time. In other words, when there is log event on servelt, I would like to see it remotely. thanks. Sam YingLCS wrote: Hi, I am using log4j in my servlet for logging. My servlet is running on Tomcat in 1 machine. How can I view the log/change log level/add filter remotely from a different machine? Thank you for any suggestion. Sam __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: DailyRollingFileAppenderExt Compatibility
Hi, You shouldn't have any problems using it in the 1.2 versions. Did you run into something? Yoav Shapira Millennium ChemInformatics -Original Message- From: PRAVIN VAJIRKAR [mailto:[EMAIL PROTECTED]] Sent: Friday, August 16, 2002 10:53 AM To: '[EMAIL PROTECTED]' Subject: DailyRollingFileAppenderExt Compatibility Is DailyRollingFileAppenderExt compatible with log4j 1.2.5?? Any ideas?? Pravin -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Log4J, JUnit ANT
Hi, Maybe this will work for your needs: - Add a -Dlog4jConfigFile=/path/to/log4j/config/file to the ant invocation. - So now you have a ${log4jConfigFile} property in ant. - You can pass this to whatever process you use to set up your test environment. If you have a central JUnit test runner, pass it this property and it can initialize log4j.. Does that help? Yoav Shapira Millennium ChemInformatics -Original Message- From: Niklas Saers Mailinglistaccount [mailto:[EMAIL PROTECTED]] Sent: Friday, August 16, 2002 11:48 AM To: [EMAIL PROTECTED] Subject: Log4J, JUnit ANT Hi, I'm using log4j to do all my logging. I'm using ant to build my system and run the tests that are based on junit. My application is a Tomcat application, so log4j works fine there. But how do I sepcify a config-file to use when running the tests in ant? Sincerely yours Niklas Saers -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Configuration question (WAS: A basic and genuine question)
Hi, a little policy-question here: i'm using log4j-configuration exactly that way (calling BasicConfigurator.configure() and then XMLConfigurator to read the config file) to ensure that logging is at least configured and in case something goes wrong with the config file (not found, for example) i can log a fatal message. I didn't mean to suggest the above was always wrong. I was only proposing it as one reason why the original poster might be having the difficulties he/she was reporting. ;) But since we're on the topic, I don't think the above is necessarily a bad approach. By nature, I tend to really constrain the environment I'm developing in: I make sure the config file is there and correct, proper permissions set, and I know exactly which code will execute first in the JVM and initialize log4j. Accordingly, I only configure it once and it's worked for me. But if you don't have a tight control over the environment, and as a backup policy, the BasicConfigurator approach is not bad IMHO. 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Article Info
Howdy, 1.4. on first glance the JDK model seems to be so similar to what Log4j uses. i think that a discussion The similarities go a lot deeper than a first glance. They're very intentional as well. The intent is to make migrating trivial. about the advantages Log4j has over the JDK logging package in this list is a must at the very minimum. Of I've found Ceki's (and other) documents on the log4j web site comparing the two APIs to be fairly helpful. Is there something not mentioned in there you'd like raised? The articles there could be updated. 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: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Feature request for DailyRollingFileAppender
Howdy, DailyRollingFileAppender? Or would I be better off deriving a class from DailyRollingFileAppender with the new functionality, hoping that it later might be rolled in? That's what I had in mind. It's been done before with DailyRollingFileAppenderExt, so at least the process will be consistent ;) Thanks for (maybe) taking this on, Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: A basic and genuine question
Hi, A basic and genuine question? OK ;) But log4j is writing output on terminal window though i did not mention rootlogger and consoleapplender anywhere, i found that the log4j writes output on terminal window default. How can i disable this from printing the log info on window.. That typically means it's misconfigured. Could it be you're calling BasicConfigurator.configure() before calling XMLConfigurator the first time? Alternativaly, please post your configuration file and initialization code and we'll be able to help more. the next question is I'm not able to use below 2nd statement with XMLLayout. Do you get an error? Not the output you expect? What do you mean by not able to use ? and please let me know how to use chainsaw? The ChainSaw docs are pretty simple. Are you having difficulties with a specific part? Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: newbie logging question
Hi, What does your layout conversion pattern for this appender look like? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Hirst [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 9:06 AM To: [EMAIL PROTECTED] Subject: newbie logging question Hi, I've been attempting to use log4j in a J2EE application, bu going thru the archives and online manual I've been able to create a couple different loggers, however I'm stumped by some of the output DEBUG [Thread-40] (GdsBuilderEJB.java:59) - +++ DEBUG [Thread-40] (?:?) - GDS GetQueryString Start: Mon Aug 12 08:38:55 EDT 2002 I don't understand why this second message does not contain the file name and number (this second log statement is also contained within a file named GdsBuilderEJB.java) Can anyone tell me what the cause might be and how to fix it. Thanks in advance! Dave Hirst -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: newbie logging question
Hi, And so you would expect to to see the file and line number on standard out, but in not in your log file. Yet you say it doesn't come out on the console, you get ?:? instead, right? Does this happen regularly? Only for particular methods? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Hirst [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 9:40 AM To: Log4J Users List Subject: Re: newbie logging question log4j.rootLogger=debug, stdout, R log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Pattern to output the caller's file name and line number. log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=/infosystems/iplanet/ias6- dhirst/ias/logs/travel/MyTravelLog log4j.appender.R.MaxFileSize=100KB # Keep one backup file log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c (%x) - %m%n log4j.logger.org.mitre.mytravel.servlet.MyTravelServlet=DEBUG log4j.logger.org.mitre.mytravel.ejb.RTSLogger=DEBUG log4j.logger.org.mitre.mytravel.ejb.GDSLogger=DEBUG log4j.logger.org.mitre.mytravel.ejb.BookingDirectorLogger=DEBUG log4j.logger.org.mitre.mytravel.ejb.BookingDataBuilderLogger=DEBUG log4j.logger.org.mitre.mytravel.ejb.DirectorProxyLogger=DEBUG Shapira, Yoav wrote: Hi, What does your layout conversion pattern for this appender look like? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Hirst [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 9:06 AM To: [EMAIL PROTECTED] Subject: newbie logging question Hi, I've been attempting to use log4j in a J2EE application, bu going thru the archives and online manual I've been able to create a couple different loggers, however I'm stumped by some of the output DEBUG [Thread-40] (GdsBuilderEJB.java:59) - +++ DEBUG [Thread-40] (?:?) - GDS GetQueryString Start: Mon Aug 12 08:38:55 EDT 2002 I don't understand why this second message does not contain the file name and number (this second log statement is also contained within a file named GdsBuilderEJB.java) Can anyone tell me what the cause might be and how to fix it. Thanks in advance! Dave Hirst -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Article Info
Hi Vikram, First of all, thank you for writing the article. All contributions are welcome and it must have taken a chunk of time. I like the section towards the end on NDC and MDC and their usage. The examples (code and configuration) throughout the article were decent. I would've advocate the use of an appender called R (or A, B, R1, etc.). Instead, a clearer name such as stdout, generalLogFile, or whatever should be used. More time could have been spent on initialization, both from a file and programmatically. Since the article assumed log4j and webapp usage, and a lot of people ask about where to put the config file, I would've covered the default initialization procedure in more detail. 1. I would really appreciate if I could get some honest feedback. :) This was my first article online and I just want to know whether to stop now before its too late. Keep writing ;) If even one person finds it useful, than it's a good service. And we already had one reply saying the person found it useful, so there are at least ten others who find it useful as well and aren't (yet) on the list ;) 2. How do I get about listing it on the log4j site? According to the info I'm not sure. I'd imagine Ceki is the judge on that. However, and this is not a knock on the article and is only IMHO, but I don't think it offers a significant amount of additional knowledge not covered in the site documentation already. On the other hand, if we were to have a central repository of anything ever written on log4j... Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: newbie logging question
Hi, What's common to the methods that do or don't display the %F:%L ? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Hirst [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 10:11 AM To: Log4J Users List Subject: Re: newbie logging question This is only happening in particular methods in particular classes. Some of the methods will display the line number and then some will not (within the same class) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: newbie logging question
Howdy, I'm afraid I can't offer more insight ;) Does the output change if you use private static final Logger logger = Logger.getLogger(GdsBuilderEJB.class.getName()); ? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Hirst [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 11:29 AM To: Log4J Users List Subject: Re: newbie logging question Both methods are public in a class named GdsBuilderEJB, they also both share a private static Logger variable shown below: private static Logger logger = Logger.getLogger(GdsBuilderEJB); Shapira, Yoav wrote: Hi, What's common to the methods that do or don't display the %F:%L ? Yoav Shapira Millennium ChemInformatics -Original Message- From: David Hirst [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 10:11 AM To: Log4J Users List Subject: Re: newbie logging question This is only happening in particular methods in particular classes. Some of the methods will display the line number and then some will not (within the same class) -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: unix syslog question
Hi, What happened when you try this? (Without modifying syslog.conf) Yoav Shapira Millennium ChemInformatics -Original Message- From: Zhu, Caizhi [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 11:35 AM To: 'Log4J Users List' Subject: unix syslog question Hi all, Has anyone worked with log4j syslog on unix? It hasn't worked for me. This is the config file snipet I use: appender name=UnixSyslog class=org.apache.log4j.net.SyslogAppender errorHandler class=com.rsa.log4j.RSAErrorHandler/ !-- Configure the address of the unix host -- param name=syslogHost value=myserver / param name=facility value=user / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p [%t] - %m%n/ /layout /appender And the appender is added to root or Category. Is there anything you need to do with syslog.conf? Thanks. Keith Zhu -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: log4j 1.2 not fully compatible with 1.1
Hi Doug, I am curious to know the use case that required you to extend Category, CategoryFactory, and Priority. Could you please describe the requirement and your solutions? Perhaps your work could become part of the log4j contribs codebase? Thanks, Yoav Shapira Millennium ChemInformatics - Original Message - From: Doug [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 08, 2002 4:34 PM Subject: log4j 1.2 not fully compatible with 1.1 i just wanted to vent my frustration at my realization that backwards compatibility was not maintained for users who have implemented custom Category/CategoryFactory/Priority classes, which we did. i realize this is a non-recommended practice, but it made good sense in our case. the framework supported it, and still does, but in an incompatible fashion. this is forcing us to either change all of our code or stay at the 1.1 level (which has known bugs in it like for RollingFileAppender). sigh. - doug __ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: servlet logging
Hi, Wow, a new log *file* for every request? Do you really want to be looking at that many log files? Anyways, here's are a couple of ideas: - Create the log file programmatically each time: This is in your service() method, or doGet() or doPost(), whichever is relevant to your design. // Create a new appender, use current date to ensure uniqueness Layout fileLayout = new PatternLayout(...); String filePath = getServletContext().getRealPath(/logs) + new Date().toString(); Appender reqAppender = new FileAppender(fileLayout, filePath); // Get logger specific to this request, again using date Logger logger = Logger.getLogger(MyServlet.class.getName() + new Date().toString()); logger.addAppender(reqAppender); logger.setAdditivity(false); // Use the logger from now on... - A couple of improvements to the above scheme: - Don't create a new layout each time. Create once and save somewhere, both to save space and to ensure all these files have the same layout. - Maybe have all that stuff in a Filter that does the above processing before the servlets get it. Then you can take that code (which would have to be in every servlet) out of the servlets and put it in one place, the filter. That said, I don't like this whole scheme of one log file per request, but it's your app ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: s s [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 5:43 PM To: [EMAIL PROTECTED] Subject: servlet logging Hi I am new to log4j so this may sound a naive question. I am wondering what is the best way to create new log file for every single request for a servelet based webapp. Can somebody suggest a code example sample log4j configuration file? Thanks Dcol - Do You Yahoo!? Yahoo! Health - Feel better, live better -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: log4j config parameters
Hi, String filePath = c:\\temp\\test1.log; Layout myLayout = ... Appender logFileAppender = new FileAppender(myLayout, filePath); (you would then do logFileAppender.setLayout() etc.) Or if the appender exists already: Logger rootLogger = Logger.getRootLogger(); Appender app = rootLogger.getAppender(LogFile); ((FileAppender)app).setFile(filePath); Yoav Shapira Millennium ChemInformatics -Original Message- From: s s [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 5:48 PM To: log4j Subject: log4j config parameters Hi How do I programatically construct following parameter instead of reading it from log4j config file: log4j.appender.LogFile.File=c:\\temp\\test1.log Thanks Dcol - Do You Yahoo!? Yahoo! Health - Feel better, live better -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Memory Leaks in Log4j
Hi, Ceki has already answered, and I myself haven't heard of nor experienced memory leaks. We have had large, long-lived servers use log4j with many Loggers and several appenders, never had any problems. However, I'm curious about something else in your question, and this may make this thread OFF-TOPIC ;) my company. the out of memory condition generally seems to have occurred when the application was made to process a lot of SNMP traps in a very brief period of time. the same memory condition does not occur when logging is turned off though. that application uses the console and file appenders. So you have an app that uses log4j's File and Console appenders only, not SNMPAppender, yet the out of memory condition occurs when there's a lot of SNMP processing going on? Did you run it with a profiler to see what's happening? Alternatively, did you try increasing the max memory a little to see if maybe those lot of SNMP traps require more memory naturally? An OutOfMemoryError does not always indicate a memory leak. Thanks, Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Can we get the number of hits to a servlet using log4j
Hi, In the service() method: logger.info(MyServlet: I'm hit! Help!); Or just do it the normal way, using the server's access file. You don't want to go down the path of using log4j to record access. Your web server should have ample provisions for this task. Yoav Shapira Millennium ChemInformatics -Original Message- From: Vullanki, Srividya [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 1:46 PM To: 'Log4J Users List' Cc: Bladon, Jeff Subject: Can we get the number of hits to a servlet using log4j Hi, Is there any way we can find the number of hits to the servlet using log4j Thanks Srividya -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: lack of memory
Howdy, I'd be careful about concluding anything regarding performance when you are running out of an IDE. Profile the code in a real environment first. That said, Xerces in the past has been known to have memory leaks. The more Documents you parse, the more memory it takes. I would recommend trying the latest version of Xerces, or alternatively (this was easy for us as we use JAXP) switch to another parser implementation, e.g. Crimson. Yoav Shapira Millennium ChemInformatics -Original Message- From: Grübel, Nicole [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 25, 2002 4:41 AM To: Log4J Users List Subject: lack of memory I just got told that it seems our system-memory gets overloaded by Java-Xerces. Does anybody have any idea this can occur? Could it be a problem with my configuration or with our applications that are using it? We are currently using Java VisualAge 3.5.3 with Log4J 1.1.3 Thanks for any advice! Nicole -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Advanced questions ? (I hope)
Howdy, 2. Is it possible to associated a log file to an INSTANCE of an object? I have object which does quite complex things and which is constructed with an Id. I would like to associate one log file per instance, such as log-id1 and log-id2 if I do new ComplexObject(id1); and new ComplexObject(id2); I think there's a relatively simple solution for this one. Don't use static loggers. Get the logger in the constructor, e.g. private final Logger myLogger; private final Appender myAppender; public myClass(int id) { ... myLogger = Logger.getLogger(myClass.class.getName() + id); // Configure myAppender, if it hasn't been done yet. // Add myAppender to myLogger. } That said, I don't think the one object instance per logger concept is that good. But it's your use case, your system ;) Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: SNMPAppender
Howdy, I second the interest in that. Check the contribs packages to see if there's something close. Yoav Shapira Millennium ChemInformatics -Original Message- From: Craig Smith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 9:12 AM To: [EMAIL PROTECTED] Subject: SNMPAppender Has anyone written an SNMP appender? I'd be interested in one. If there isn't one available I might pick away at it. Craig Please Note The information in this E-mail message is legally privileged and confidential information intended only for the use of the individual(s) named above. If you, the reader of this message, are not the intended recipient, you are hereby notified that you should not further disseminate, distribute, or forward this E-mail message. If you have received this E-mail in error, please notify the sender. Thank you * -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: large scale log4j configuration
Hi, It sounds like some of your problems come from relying on the default log4j startup configuration, where it looks for log4j.properties on the classpath. A possible alternative, the one we use, is to write a startup servlet that loads on server startup and does the log4j configuration for you. You could then further add a GUI of sorts to that servlet for runtime changes of the logging system. Or a simple reload from this URL-type function where you specify the URL to a new configuration file you just edited. Yoav Shapira Millennium ChemInformatics -Original Message- From: Lu, David [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 2:22 PM To: [EMAIL PROTECTED] Subject: large scale log4j configuration Hi everyone, Where do most people put their configuration files in a multi-ear, multi- war and multi-jar environment? I see several cons of putting each configuration file within each jar (as opposed to the system cp). 1. For my webapp, I have a security.jar file which uses log4j. This security.jar is in the WEB-INF/lib directory of my webapp. When the application is deployed, log4j complains that there are no appenders defined for a logger used in security.jar. However, if I place the configuration file in the system CP, everything is fine. 2. If the configuration file is placed inside each application's jar, doesn't this make for management headaches, say, if I want to do a change configuration on the fly but don't have access into each jar file to get at the configuration file? Thanks for reading. David ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: DailyRollingFileAppender+ backup
Howdy, I don't think that's part of log4j's job. I'd be surprised it if were possible to do, using log4j only. However, it would be easy to write a shell script to copy all files except mylogs.log to the backup directory every day. Yoav Shapira Millennium ChemInformatics -Original Message- From: Stephane Nicoll [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 7:23 AM To: 'Log4J Users List' (E-mail) Subject: DailyRollingFileAppender+ backup Hello, I am using DailyRollingFileAppender to split my log files every day. Is it possible to copy the file in another location once it has been splitted. More explicity, if I have a log into /var/log/myapp/mylogs.log and it's splitted I would like that mylogs.log.2002.04.24 go into /var/log/myapp/mylogs/backup ? Is it possible, I am using XML configuration. My configuration file is as follows: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=A_1 class=org.apache.log4j.DailyRollingFileAppender param name=File value=../logs/BE/lbclient.log / param name=Append value=true / param name=DatePattern value='.'-MM-dd / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ISO8601} [%t] %- 5p %35.35c{5} - %m%n/ /layout /appender category name=org.apache.log4j.xml appender-ref ref=A_1 / /category root priority value =debug / appender-ref ref=A_1 / /root /log4j:configuration Thanks and best regards, Stéphane Nicoll -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logging Problem (think it is log4j)
Howdy, commons-logging is part of the Commons Logging package. It's not related to log4j except on the conceptual level, both being dynamically configurable logging frameworks. I think commons-logging actually allows you to use log4j as the underlying mechanism though. Therefore, your question belongs in the commons-logging mailing list ;) As a guess, even though I don't want to continue this thread as it doesn't belong on this list, you may have two versions of the same class in your runtime classpath. An ExceptionInInitializerError would be thrown when the VM tries to instantiate a class with a constructor that's different from what's in the actual .class. Check your classpath (including server libraries if you're using tomcat or whatever) to make sure you don't have duplicate classes. Yoav Shapira Millennium ChemInformatics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 11, 2002 11:54 AM To: [EMAIL PROTECTED] Subject: Logging Problem (think it is log4j) From: Ryan D. Cuprak Hello, I recently downloaded Sun Microsystems webservices packet which came with a jar commons-logging.jar which I think is a permutation of log4j (possibly old) but not sure. Anyway, when I attempt to run my applet in a browser I get the following exception trace (below) which I do not get if I run the applet in my ide. Is org.apache.logging related to log4j? I downloaded the latest log4 and it didn't look anything like the jar from sun (contents). -Thanks, Ryan Cuprak Exception: java.lang.ExceptionInInitializerError: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryIm pl.j ava:494) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryIm pl.j ava:285) at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.clinit(HttpS OAPC onnection.java:37) at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory.createC onne ction(HttpSOAPConnectionFactory.java:25) at com.kodak.sis.applet.UserList.UserListApplet.sendSOAPMessage(Unknown Source) at com.kodak.sis.applet.UserList.UserListApplet.start(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) java.lang.ExceptionInInitializerError: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryIm pl.j ava:494) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryIm pl.j ava:285) at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.clinit(HttpS OAPC onnection.java:37) at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory.createC onne ction(HttpSOAPConnectionFactory.java:25) at com.kodak.sis.applet.UserList.UserListApplet.sendSOAPMessage(Unknown Source) at com.kodak.sis.applet.UserList.UserListApplet.start(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: StaticHierarchy class?
Howdy, Why is saving memory not important? Saving memory is important. However, like Ceki said (I've verified this using a profiler for our system), the Logger instances (even at 1 for each class) take so much less memory than your application classes, that their memory footprint is insignificant. And ultimately, IMHO memory is cheap and performance (speed) matters more than memory. Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: ClassCastException in 1.2.4
Howdy, Please post your configuration file. Thanks, Yoav Shapira Millennium ChemInformatics -Original Message- From: Edward Q. Bridges [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 3:56 PM To: [EMAIL PROTECTED] Subject: ClassCastException in 1.2.4 this is a new error that has begun appearing sporadically since we upgraded. unfortunately, all our development grinds to a halt, since it won't print any messages to the console after this. therefore, it's a pretty big issue for us. has anyone encountered this? thanks --e-- log4j:ERROR Could not create an Appender. Reported error follows. java.lang.ClassCastException: org.apache.log4j.RollingFileAppender at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java :165 ) at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator .jav a:140) at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigu rato r.java:153) at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMCo nfig urator.java:415) at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java :335 ) at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:788) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:6 73) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:6 16) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:5 84) at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:694 ) at teachscape.common.log.LogWrapper.start(Unknown Source) -- Edward Q. Bridges http://www.teachscape.com -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Performance logging
Hi, We use keywords that identify large processes / jobs within the applications. So in all the log statements relevant to process A, there'd be a string like processAPerformance or whatever. We then have little java command line utilities to analyze log files and output performance measurements, etc. (As a sidenote: right now it goes to text files, which we then import into excel. However, I'm considering writing some HSSF (from Apache-POI) code to directly create the excel worksheets. Anyone doing this right now?) Yoav Shapira Millennium ChemInformatics -Original Message- From: Christian, William [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 10:14 AM To: Log4J Users List Subject: Performance logging Anyone have any strategies on creating identifiable log entries for performance timing of an application? Specifically, I have a client/server application. I want to log when a transaction is sent and when it is returned (easy enough). But I want to be able to extract those log entries to compile performance statistics. My initial thought is to create a unique category/level. However, I want to know if anyone else found an alternative method. - billc -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Performance logging
Howdy, Yup, INFO. As a sidenote, for a given webapp we have the root logger run at WARN level, the root for that webapps's classes (i.e. com.mycompany.mywebapp) at INFO level. That seems to work well for us. Yoav Shapira Millennium ChemInformatics -Original Message- From: Christian, William [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 11:22 AM To: 'Log4J Users List' Subject: RE: Performance logging At what level do you output the string? INFO? -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 10:31 AM To: Log4J Users List Subject: RE: Performance logging Hi, We use keywords that identify large processes / jobs within the applications. So in all the log statements relevant to process A, there'd be a string like processAPerformance or whatever. We then have little java command line utilities to analyze log files and output performance measurements, etc. (As a sidenote: right now it goes to text files, which we then import into excel. However, I'm considering writing some HSSF (from Apache-POI) code to directly create the excel worksheets. Anyone doing this right now?) Yoav Shapira Millennium ChemInformatics -Original Message- From: Christian, William [mailto:[EMAIL PROTECTED]] Sent: Friday, June 14, 2002 10:14 AM To: Log4J Users List Subject: Performance logging Anyone have any strategies on creating identifiable log entries for performance timing of an application? Specifically, I have a client/server application. I want to log when a transaction is sent and when it is returned (easy enough). But I want to be able to extract those log entries to compile performance statistics. My initial thought is to create a unique category/level. However, I want to know if anyone else found an alternative method. - billc -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Bug with Telnet and RollingFileAppender ?
Howdy, Do the two programs (or n instances of the program, in general) have the exact same log4j configuration file? i.e. are they writing to the same RollingFileAppender, and using the same TelnetAppender? Yoav Shapira Millennium ChemInformatics -Original Message- From: Marc Herren [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 7:46 AM To: [EMAIL PROTECTED] Subject: Bug with Telnet and RollingFileAppender ? Hi , I started to test log4j as log facility for our application. During those test I found the following problem : When running one instance of our program everything works fine but as soon as there are two or multiple instances of our program running the Telnet and RollingFileAppender behaves strange. The TelnetAppender just blocks the main program which is a serious problem. The RollingFileAppender works fine but the file rotation is corrupt ( no backup files or at wrong size ) I'm new to log4j , I searched the web, buglist and the mailinglist but didn't found an answer/hint to this problem. Can log4j be used when running multiple copies of the program on the same machine ? Thanks for any help Marc = Marc Herren e-mail: [EMAIL PROTECTED] Tel.: ++41 31 999 39 15 Fax.: ++41 31 999 30 57 ASCOM Transmission Ltd. Carrier Access / GAAD Belpstrasse 37 3000 Berne 14 Switzerland http://www.ascom.ch http://www.broadnet.ascom.ch -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: DailyRollingFileAppenderExt
Howdy, I had a bet with a co-worker that Sara Prigge would be the first to respond with the jar attached. ;) ;) ;) I've been on this list for too long ;) Does the DailyRollingFileAppenderExt need updating for v1.2? Yoav Shapira Millennium ChemInformatics -Original Message- From: Sara Prigge [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 04, 2002 10:03 AM To: 'Log4J Users List' Subject: RE: DailyRollingFileAppenderExt I used this with log4j v.1.1.3 - works great. -Original Message- From: Boon Hwang [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 04, 2002 1:19 AM To: [EMAIL PROTECTED] Subject: DailyRollingFileAppenderExt Where can I find the DailyRollingFileAppenderExt jar file? Can someone email me the jar file? Thanks in advance. --Boon -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: logger not working with servlet
Howdy, You're probably outputting log4j statements before the log4j system is configured. You need to make sure you call something like PropertyConfigurator.configure(your config file path) before making any log4j statements. A good place to do this is in the init() method of a servlet that you load on server startup. Also, make sure that your properties file is visible to that servlet. Yoav Shapira Millennium ChemInformatics -Original Message- From: Peter Choe [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 9:31 AM To: [EMAIL PROTECTED] Subject: logger not working with servlet i am trying to log4j to work with a servlet on tomcat4.0 and java1.4 on a solaris intel machine. but when i try to call the servlet to get it to log, i get the following message: log4j:WARN No appenders could be found for logger (roster.TallyTest). log4j:WARN Please initialize the log4j system properly. this is my log property file: log4j.rootLogger=debug, A1, R log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=/export/home/tomcat/logs/coursetally.log log4j.appender.R.MaxFileSize=100KB log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n ~ any suggestions on why it isn't working for my servlets, but works for stand alone java applications? Peter Choe -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: logger not working with servlet
Howdy, public void init(ServletConfig config) throws ServletException{ super.init(config); prefix = getServletContext().getRealPath(/); file = getInitParameter(log4j-init-file); System.out.println(Prefix: + prefix); System.out.println(File: + file); 1) It's a good idea to override the init() method, rather than the one that takes a ServletConfig argument. That way you don't have to call super.init(config). 2) Are you deploying from a .war file? If so, getRealPath(/) will return null. 3) I've never had any problems getting init-params from web.xml. I suspect a lot of people would complain if tomcat was messing this up ;) Are you sure the servlet whose code you posted is the one that gets invoked? What is the output from the two System.out.println() statements in the code? Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Log4j and Tomcat apps
Howdy, I don't know the answer, but I wanted to say I'm very interested in this question as well. Mr. Gülcü or anyone else care to comment? ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 8:52 AM To: [EMAIL PROTECTED] Subject: Log4j and Tomcat apps I was reading the Log4j manual and it suggests that for each webapp, you should use a separate log4j jar file in each WEB-INF/lib to make sure that each log4j is in its own log4j Universe. However, this puts constraints on where I put my libraries that use log4j. For instance, if I have log4j in WEB-INF/lib, I can't have libraries that use log4j in TOMCAT_HOME/lib because the libraries in the parent classloader won't find the Log4j libraries in the child classloader. However, that is where I'd like to put some of my libraries since they are common to all my webapps. In fact, Log4j is common to all my webapps so I'd like to put it in TOMCAT_HOME/lib as well. However, this would cause conflicts becase Log4j would no longer be running in its own Log4j Universe. So, in a manner of speaking, my libraries are being held hostage in WEB-INF/lib because Log4j is designed in a way that it needs to live on it's own and not be shared by multiple apps at once. Have I interpreted things wrong, or is this what was intended? Is there anything I can do to keep my libraries from being held hostage? Are there any tricks that I'm missing here? Jake -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: console/file config
Howdy, It'd be a good idea for you to define a root logger, as in log4j.rootLogger=DEBUG, chart Then your personal classes, e.g. log4j.logger.com.neuroquest.cais.web.velocity.RunningChart=DEBUG Then your appender properties for the chart appender, as below. They seem to make sense. One thing is that I think properties files require \ before space, so conversion pattern=[%x\ (%c{1})]\ %m%n I think the stuff below is missing the rootLogger. log4j.category.com.neuroquest.cais.web.velocity.RunningChart=DEBUG, chart log4j.appender.chart=org.apache.log4j.RollingFileAppender log4j.appender.chart.File=/tmp/chart.log log4j.appender.chart.MaxFileSize=100KB log4j.appender.chart.MaxBackupIndex=3 log4j.appender.chart.layout=org.apache.log4j.PatternLayout log4j.appender.chart.layout.ConversionPattern=[%x (%c{1})] %m%n Also, I'd like to know how to configure only error and fatal to console output, and how to turn on/off everthing else into the file appender. There are a couple of ways to do this. My preference is to have the lower priority appender (in your case the file appender) get everything, not just the DEBUG, INFO, WARN, but also the ERROR and FATAL. Makes things much easier to analyze. So your just set the threshold for the file appender to DEBUG, and that for the console appender to ERROR. log4j.appender.chart.Threshold=DEBUG log4j.appender.console.Threshold=ERROR See the javadoc for PropertyConfigurator and the Threshold property for more details. Yoav Shapira Millennium ChemInformatics -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Using log4j
Howdy, It's definitely and easily possible with log4j. See the javadoc for DailyRollingFileAppender. (If you've never used log4j before, it may make better sense if you read the short manual first). Depending on how your own logging mechanism works, it may make sense to use a façade and just use all log4j under it, or replace your mechanism with log4j altogether. Good luck ;) Yoav Shapira ChemInformatics -Original Message- From: Anand M S [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 21, 2002 4:00 PM To: [EMAIL PROTECTED] Subject: Using log4j Hi, I'm new to this group. Currently I have my own logging mechanisim, but I want to reset(should archive the old file and start new file) the log file depending on date, is this possible with log4J? can I use log4j in my logging module for this purpose? Thanks in advance, Anand - Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: chainsaw
Howdy, My off-the-hip,not-thinking-deeply-this-early-in-the-morning answer would be to try JAXP and/or Xalan along with crimson (not by themselves). But that may be because I have them together for some other reason which I've forgotten by now ;) Yoav Shapira ChemInformatics -Original Message- From: Krishna srinivasan [mailto:[EMAIL PROTECTED]] Sent: Friday, May 03, 2002 5:05 AM To: Log4J Users List Subject: RE: chainsaw Shapira, I tried using my host name and then even my ip. It doesn't seem to work. + F:\IplanetWebServer6\docs\DOTS\WEB-INF\classesjava com.puppycrawl.tools.chainsaw.Main log4j:ERROR Could not connect to remote log4j server at [205.229.110.49 ]. We will try again later. + Infact after all this chainsaw starts up first with a dialogue box that's says ' Unable to create XML parser - unable to load XML events'. Once i click ok it throws up the GUI with no logs in them. the following entries are there in my classpath : F:\jakarta-log4j-1.2rc1\jakarta-log4j-1.2rc1\dist\lib\log4j-1.2rc1.jar; F:\chainsaw-1.1\chainsaw-1.1\chainsaw-1.1.jar; F:\crimson-XML\crimson.jar is there anything more required to run chainsaw? Thanks, krishna --- Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Try using the actual name of the host, something other than localhost. Just an idea ;) Yoav Shapira ChemInformatics -Original Message- From: Krishna srinivasan [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 02, 2002 5:57 AM To: Log4J Users List Subject: chainsaw Hi all, i'm having problems running chainsaw from the command line. I'm getting the following error. log4j:ERROR Could not connect to remote log4j server at [localhost ]. We will try again later. * Attached is the exception trace[chainsaw.txt] and log4j.properties. Any suggestions will help me greatly. thanks, Krishna __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: chainsaw
Hi, Try using the actual name of the host, something other than localhost. Just an idea ;) Yoav Shapira ChemInformatics -Original Message- From: Krishna srinivasan [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 02, 2002 5:57 AM To: Log4J Users List Subject: chainsaw Hi all, i'm having problems running chainsaw from the command line. I'm getting the following error. log4j:ERROR Could not connect to remote log4j server at [localhost ]. We will try again later. * Attached is the exception trace[chainsaw.txt] and log4j.properties. Any suggestions will help me greatly. thanks, Krishna __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: log4j performance
Hi, Like someone else in the list, we've made it a convention to add the check everywhere we use logger.debug(). Obviously, it may not be a big deal unless you have thousands of debugging statements and/or debug-level statements in code that gets executed very frequently. On a bright note, if the rest of your code is so well written/optimized that logging is your biggest bottleneck, you've probably done an excellent job ;) Yoav Shapira ChemInformatics -Original Message- From: Saripalli, Raju [mailto:[EMAIL PROTECTED]] Sent: Friday, April 19, 2002 12:05 PM To: 'log4j-user (E-mail)' Subject: RE: log4j performance Yikes! I just realized that my whole question is moot. Obviously 3 is going to be faster than 2 (i.e when logging is turned off). And 4 is probably slower than 2 when logging is turned off. This is because the method parameters to the log method are still evaluated and also there is the added overhead of a method call. I guess the question now is, how many of you out there add the check? if (logger.isDebugEnabled()) { logger.debug(Entering add); } Does adding the check really make a difference in the big scheme of things ? Thanks again, Raju -Original Message- From: Saripalli, Raju Sent: Friday, April 19, 2002 11:14 AM To: log4j-user (E-mail) Subject: log4j performance Hi, I am currently introducing log4j into the new project that I am working on. (I used Vs. 1.0? on a previous project). One of the questions I am trying to address is the logging performance. I will be running several of my own test scenaruios to see what logging approach would be the best based upon two factors: (1) Time taken to execute logging (2) Ease of use If anyone has any sort of input on this topic, please shout it out. Here are the different test scenarios: (This is not the test code ... just a rough example :) ) 1. Baseline : No logging code in the program public class A { public int add(int a, int b) { int temp = a + b; return temp; } } 2. Basic: Logging code inserted, no checking whether logging is enabled public class A { public int add(int a, int b) { logger.debug(Entering add); int temp = a + b; logger.debug(Exiting add); return temp; } } 3. Checking : Logging code inserted, check if logging is enabled before actually logging public class A { public int add(int a, int b) { if (logger.isDebugEnabled()) { logger.debug(Entering add); } int temp = a + b; if (logger.isDebugEnabled()) { logger.debug(Exiting add); } return temp; } } 4. Wrapping : Wrap the logging code into a method in an object ... developer does not need to directly check if logging is enabled public class A { public int add(int a, int b) { wrapped_logger.debug(Entering add); int temp = a + b; wrapped_logger.debug(Exiting add); return temp; } } public class WrappedLogger ... { . public void debug(Object message) { if ( this.isDebugEnabled()) { super.debug(message); } } } Has anyone tried any of these approaches and what have their findings been? Thanks much, Raju -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: log4j vs jdk 1.4 logging
Hi, So a couple of points... 1) I prefer log4j. From the time I first downloaded it, it was very easy to set up, use, and re-configure (at both design and run time, including on very large scale production systems). The DailyRollingFileAppender works great for me ;) I like that it's free, light, and high performance. I don't think the JDK1.4 logging API can possibly be high performance at this point, as it can't have been tested on many production systems yet. (Yes, I'm one of those people who believe that to be rock-solid, something needs to have a bit of maturity behind it ;)) 2) Regarding Jakarta-commons: I've tried it and made it work. However, one caution that I try to keep in mind when adding an interface layer that will accept many (typically, 200-300/minute in some of our systems, including a lot of isDebugEnabled() type calls) is that on some systems, calling an interface method is up to 6x slower than calling the same method on a regular class. I don't remember where I saw this number, but it was an official benchmark from either Sun or IBM, and I was able to confirm it on my own system. I think the above (#2) might be part of the reason these APIs are not an interface, and that's the reason we don't use Jakarta-commons. If we were a lower-throughput system, I'd definitely be stronger biased towards it, but this is a conscious performance-oriented decision we've made. Just my due centi, Yoav Shapira -Original Message- From: Edward Q. Bridges [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 10, 2002 11:41 PM To: Log4J Users List; Steve Cohen Subject: RE: log4j vs jdk 1.4 logging i would strongly suggest that you switch your application to using the logging interface in the jakarta commons package. then, you are free to plug in either log4j or jdk1.4. the great flaw of both of these packages is that they were not coded from an interface, and the interface they offer is what is hardcoded into their classes. HTH --e-- On Wed, 10 Apr 2002 18:05:50 -0500, Steve Cohen wrote: I am in the position of recommending a switch to either log4j or jdk 1.4 from a roll-your-own system that has outgrown its original usefulness. -- Edward Q. Bridges http://www.teachscape.com -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Log4j's UI
Howdy, Check out the external utilities for log4j at the download page: http://jakarta.apache.org/log4j/docs/download.html I personally use Chainsaw and like it a lot, haven't tried any others. Yoav Shapira ChemInformatics -Original Message- From: hello [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 4:03 AM To: [EMAIL PROTECTED] Subject: Log4j's UI Does anybody know whether there is some UI for Log4j existing? This message was posted using eunum --- http://www.cn.eunum.com/ To interact with a real-time, threaded interface to this e-mail list, go visit the link The Log4j User List below: http://www.cn.eunum.com/discussions/2-480.html . -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]