2 apps, 2 sets of files, common util classes
Hi all, We have two applications that should be writing to different log files in different directories. These applications use a set of common utility classes where the logger is set up with a statement such as: private static Logger logger = Logger.getLogger(Player.class); The problem we have is that log messages from application 'a' using this class gets its messages written to both log files for app 'a' and app 'b'. The two apps are run from separate jar files but we do not want to hard code the differences in the common util classes. Any clues on how we can avoid this ? Regards, Bill Comer Regards, Bill Comer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 2 apps, 2 sets of files, common util classes
Howdy, Each app should have its own copy of the common jar. Don't place one copy of the commons jar in a common classloader repository, e.g. tomcat's $CATALINA_HOME/common/lib. Yoav Shapira Millennium ChemInformatics -Original Message- From: Bill Comer [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 8:34 AM To: [EMAIL PROTECTED] Subject: 2 apps, 2 sets of files, common util classes Hi all, We have two applications that should be writing to different log files in different directories. These applications use a set of common utility classes where the logger is set up with a statement such as: private static Logger logger = Logger.getLogger(Player.class); The problem we have is that log messages from application 'a' using this class gets its messages written to both log files for app 'a' and app 'b'. The two apps are run from separate jar files but we do not want to hard code the differences in the common util classes. Any clues on how we can avoid this ? Regards, Bill Comer Regards, Bill Comer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Trying to put logs under ${CATALINA_HOME}/logs/
Ok I've narrowed down the problem, this works fine: log4j.appender.myAppender.File=c:/jakarta-tomcat-4.1.24/logs/my_log.txt but this doesn't: log4j.appender.myAppender.File=${CATALINA_HOME}/logs/my_log.txt it would appear that it completely ignores the ${CATALINA_HOME} variable, which I have checked is defined. can anyone suggest a reason for this? I tried it with ${catalina.base} which i saw somewhere but that doesnt work either. And it doesnt like ${file.separator} either. I'm running winNT. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 2 apps, 2 sets of files, common util classes
Howdy, I also meant the inverse of my solution, which is the apps should have separate log4j.jar files. Each one should have its own copy of log4j in its WEB-INF/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: Bill Comer [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 8:51 AM To: [EMAIL PROTECTED] Subject: RE: 2 apps, 2 sets of files, common util classes To answer Yoav, Although the util classes are common they are built into the jar file for each app, so to answer your question. No they are not from a common jar file. However both apps pick up the same log4j.jar To answer Ceki. The apps are running in a separate web apps in the same servlet container ( resin) Regards, Bill Comer -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: 14 August 2003 13:42 To: Log4J Users List Subject: Re: 2 apps, 2 sets of files, common util classes Do these two applications run in a servlet container (e.g. Tomcat) or an EJB container (e.g JBoss)? At 01:34 PM 8/14/2003 +0100, you wrote: Hi all, We have two applications that should be writing to different log files in different directories. These applications use a set of common utility classes where the logger is set up with a statement such as: private static Logger logger = Logger.getLogger(Player.class); The problem we have is that log messages from application 'a' using this class gets its messages written to both log files for app 'a' and app 'b'. The two apps are run from separate jar files but we do not want to hard code the differences in the common util classes. Any clues on how we can avoid this ? Regards, Bill Comer -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: calling DOMConfigurator.configureAndWatch() 2 times
Howdy, Also, it is programmatically possible to check if Log4j has been configured previously, thus avoiding the problem (which may or may not help in this particular case). My development team creates components used throughout our enterprise, and if an application has configured Log4j, we want to avoid configuring it ourselves and instead piggy-back off their configuration. This is a good habit: we do the same thing. The code to check if Log4j has been configured follows: public static boolean isConfigured() { snip This code is also on the log4j wiki pages as it's a FAQ. Note that it's not guaranteed to be 100% effective, i.e. it might return false positives or negatives. I haven't run across such a case yet, but it's a CYA statement. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Instant Logging Article
I could really use something like this myself. Could we perhaps ask if the author might be in a position to be able to donate the source code into the sandbox? cheers, Paul On Thu, 2003-08-14 at 06:14, Ceki Glc wrote: I hadn't seen it before. Really well written and informative article. I have a weak spot for SMTPAppender. (If you are not using it, you should.) I am still not 100% convinced, but this article makes a good case of why IMAppender might be preferable to SMTPAppender under certain circumstances. Thanks for forwarding it. At 09:08 AM 8/13/2003 -0400, you wrote: Howdy, Even though I'm sure many have seen it, I wanted to send a link to this interesting article: http://www-106.ibm.com/developerworks/java/library/j-instlog/ The article has an overview of log4j and details on how to implement a remote instant messages (IM) appender. Yoav Shapira Millennium ChemInformatics - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple loggers with different level problem
This is not a bug, it's by design. We ran into the same confusion some time ago. Once a log call is accepted, it is run entirely up the logging hierarchy. So, suppose logger A is set to OFF. Suppose A.B.C is set to DEBUG. At first glance, one might expect logging calls in A.B.C to *not* be sent to A's appenders, but this is not the case. Once accepted, all appenders up the chain are fair game. In a sense, the filtering of log messages only occurs at the level of the call (which might be inherited if not explicitly set at that level), and that determines alone if it goes up the chain or not. So, if a DBUG call were made in A.B.C.D, for instance, that would go all the way up the chain to appenders attached to A, A.B, A.B.C, and A.B.C.D. I'm not too sure about the converse - suppose A is set to DEBUG, and A.B.C is set to OFF. I'm not sure what would happen to calls in A.B.C - you'd have to test that. I suspect they'd go to no appenders at all. One way to get around this, I think, is to use filters on the appenders. Not only can logging levels be controlled in the hierarchy, but a filter can be attached to specific appenders. You'll have to check out the documentation for this, I don't know how to do this off the top of my head. Hopefully this makes sense. It confused us too at first, but once we got used to the idea it wasn't a problem. It's just a little different than what one might originally anticipate. Mike -Original Message- From: Geir Antonsen [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 11:12 AM To: Log4J Users List Subject: Multiple loggers with different level problem I've run into a problem with having different log levels for to (or more) loggers on the same branch in logger hierarchy. It seems that even if the parent logger level is set to OFF, it logs all messages that its child logs. Example: logger name=implementation level value=OFF / appender-ref ref=Console / /logger logger name=implementation.com.metro.telenor.test.MetroLogTestClientOtherClass level value=ON / appender-ref ref=Chainsaw / /logger ...will log to both Console and Chainsaw. Is it possible to get around this behaviour? Have I missed a point somewhere? Is it a bug? Regards Geir Antonsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message and any included attachments are from Siemens Medical Solutions USA, Inc. and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to [EMAIL PROTECTED] Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Urgent... Log 4j 1.2.7 issue...
Hi All I was able to run log4j 1.1.3 version in my environment without any problems. Now when I updated my log4j to ver 1.2.7 and I boot my weblogic server I get the following error, log4j:WARN No appenders could be found for logger (ABC_FILE_1_0.Configuration). log4j:WARN Please initialize the log4j system properly. log4j:ERROR Attempted to append to closed appender named [FileAppender]. log4j:ERROR Attempted to append to closed appender named [ConsoleAppender]. Can you let me know what the problem could be? I know it is related to some configuration issue. Does it have to do with the fact that in 1.2.7 when we boot the server we have to mandatory mention the log4j:file location as -D option? Thanks Mayur. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 apps, 2 sets of files, common util classes
Do these two applications run in a servlet container (e.g. Tomcat) or an EJB container (e.g JBoss)? At 01:34 PM 8/14/2003 +0100, you wrote: Hi all, We have two applications that should be writing to different log files in different directories. These applications use a set of common utility classes where the logger is set up with a statement such as: private static Logger logger = Logger.getLogger(Player.class); The problem we have is that log messages from application 'a' using this class gets its messages written to both log files for app 'a' and app 'b'. The two apps are run from separate jar files but we do not want to hard code the differences in the common util classes. Any clues on how we can avoid this ? Regards, Bill Comer -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Instant Logging Article
whoops! Of course, now that I re-read the archived post, I see that the author of the ibm.com article and the person who submitted IMAppender to the mailing list are one and the same. I shall slink now back into my troll status... -Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Instant Logging Article
Howdy, Even though I'm sure many have seen it, I wanted to send a link to this interesting article: http://www-106.ibm.com/developerworks/java/library/j-instlog/ The article has an overview of log4j and details on how to implement a remote instant messages (IM) appender. Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating log files relative to the web applications root directory?
Well, actually, under Tomcat, I wrote an InitContextListener which automagically figures out where the current webapp exists and sets a system property which is referenced in log4j.xml and, viola!, the log files are placed in WEB-INF/logs of the current application no matter where it exists and without ever hardcoding the actual path. Of course, this assumes you actually have write access to your webapp which is not guaranteed by the servlet spec. In that case, your file appender will not work since it won't have a valid location to write to. See the InitContextListener in the log4j-sandbox. Instructions are in the javadoc. See info and links here... http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging Jake At 08:35 PM 8/13/2003 +1000, you wrote: G'day, U, so basically then it is not possible to define a directory path in the log4j.xml properties file so that log files are placed relative to the web apps root directory? Or for that matter relative to any known anchor point like the server root directory? A problem we have is that we deploy .war files by sending the package to the server gods who then drop it into the webapps directory. Alas we don't have the rights to deploy directly to the server environment and tools like ANT whilst are good at building a distributable archive they do not quite make the grade when resolving tokens in a dynamic style of deployment. Another issue we have is that most of the development work is done on a Windows based machine and the production servers are hosted on a flavor of Unix. Hard coding a directory path like C:\..\ may work when doing the dev work under Windows but just don't kind of cut it on a Unix file system when it comes time to deployment. BTW, the last time I looked me was male so I'll opt out for king! AB -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, 11 August 2003 11:14 PM To: Log4J Users List Subject: RE: Creating log files relative to the web applications root directory? Howdy, I suppose Adrian could be a woman's name as well, so you're right ;) AmendedVersion But if you're the server admin, you're king (or queen) ;) /AmendedVersion Yoav Shapira Millennium ChemInformatics -Original Message- From: Caroline Wood [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:13 AM To: 'Log4J Users List' Subject: RE: Creating log files relative to the web applications root directory? or Queen! lol ;) -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 11 August 2003 14:05 To: Log4J Users List; [EMAIL PROTECTED] Subject: RE: Creating log files relative to the web applications root directory? Howdy, What I've seen done to achieve this is have my ant deployment script fill the value when copying log4j.xml over. So in log4j.xml, you'd have param name=File value=@logFilePath@ / And in your ant script, you set filtering=true when copying log4j.xml, and replac the logFilePath token with the actual (absolute) path. As an aside, note that the servlet container is not required to give you write access under your webapp's root. In fact, many server admins dislike this, as they prefer a centralized log location for their systems. But if you're the server admin, you're king ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Adrian Beech [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 6:42 AM To: 'Log4J Users List' Subject: Creating log files relative to the web applications root directory? G'day, Is it possible to specify a log filename in the XML log4j properties file so that it is relative to the web applications root directory? I have the following in a log4j.xml file located in web-inf/classes with the log4j jar in the web-inf/lib directory. Logging seems to be fine except the rascal.log file is being created in the Tomcat application directory under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory tree. I'd prefer to have the log files in something like ../webapps/application/logs/logfilename. Is this possible? BTW, took a while to find the rascal.log file!!! --[log4j.xml]- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=rf class=org.apache.log4j.RollingFileAppender param name=file value=rascal.log/ param name=maxBackupIndex value=2/ param name=maxFileSize value=250KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{dd/MM/ HH:mm:ss} %-5p (%t) %l - %m%n/ /layout /appender root priority value=debug / appender-ref ref=rf/ /root /log4j:configuration --[End Of File]--- I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and Tomcat 4.1.24 on a Unix box as the
As always... another ISAPIredictor.dll issue
To all, Can anyone tell me how to get the isapi-redirector2.dll to work. I just installed Tomcat 5.0 and have not been able to get the isapi filter to turn on in IIS. It always has a red down arrow. My environment: Windows XP-Pro IIS v5.05 Tomcat v5.0 Any advise would be gratefully appreciated. The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j: dump wrap-around buffer of all log messages
At 03:23 PM 8/11/2003 +0200, you wrote: From: Hancke Patrick [mailto:[EMAIL PROTECTED] [...] The wrap-around buffer (think of it as an array of let's say 500 log messages) contains at any moment, the last 500 log messages. The idea is that the logger has 2 log levels: one which determines what level is present in the log file (or std out or whatever), another which determines at what level the internal wrap-around buffer is filled with messages. This way, it is possible to let your application log at level INFO, while the internal buffer keeps all messages of level DEBUG or higher. When an exception is thrown, the user should have the ability to request a dump of the buffer, such that the more detailed DEBUG messages are also present in the log file to make debugging more easy. Yes, possible. You have to implement a small appended built around CyclicBuffer (found in some one of the log4j packages) and that's it. Then you can use a log4j xml config file like this. This will send all INFO and higher messages to normal appender and all debug messages will land at the debug appender and you're free to handle those messages in the CyclicBuffer as you like. log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=debug class=ams.v9.logging.MyAppendedBuiltAroundCyclicBuffer whatever params I take/ /appender appender name=normal class=org.apache.log4j.DailyRollingFileAppender param name=File value=logs\\server.log/ param name=DatePattern value=.-ww/ filter class=org.apache.log4j.varia.LevelRangeFilter param name=LevelMin value=INFO / /filter /appender root priority value=debug/ appender-ref ref=debug/ appender-ref ref=normal/ /root /log4j:configuration Good suggestion. Note that it is also possible to cascade appenders. For example, a BuferedAppender to which you can attach other appenders like the AsyncAppender. -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: New issue on Log4J initialization
Keith, The problem I have with removing all that stuff is that 90% of it was put there by applications. Should I remove parts of it anyway? I guess that's where my confusion is since (as I said) most of these variables were entered by the installation of the applications themselves. Thanks for your thoughts Keith! -Original Message- From: Keith Hatton [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:18 PM To: Log4J Users List single period = . = class files etc. based on this directory only. It's just that the CLASSPATH environment variable often does more harm than good. If you use java -cp something then the CLASSPATH is ignored, and often scripts that start Java apps will do just that. But then again, sometimes they add your CLASSPATH to theirs. That's when the trouble starts ... So basically, Jake's advice is, remove your CLASSPATH environment variable if at all possible. Certainly that sounds like way too much junk in there. Hope this helps Keith -Original Message- From: Farrell, Timothy [mailto:[EMAIL PROTECTED] Sent: 08 August 2003 17:00 To: Log4J Users List Subject: RE: New issue on Log4J initialization Can you (or someone)explain your first statement (I'd change your classpath to be no more than a single period)? I have both installed on my machine however, I only run one at a time depending on what I am working on. My app does not use struts or anything else requiring commons-logging. Jake, Enjoy your vacation! And thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 11:49 AM To: Log4J Users List Yikes. I'd change your classpath to be no more than a single period. Set the classpath as needed in scripts. That way, you won't force libraries that aren't needed or collide with other libraries on every app you run. Just to be clear. Are you running Tomcat or Websphere? I can't tell you what the behavior in Websphere will be. Tomcat should definitely work for logging, though. BTW, what does your app consist of? Does it use Struts or anything else requiring commons-logging? That's the most evil invention to come out of the Apache project. In my experience, it just messes up everything. If this is an issue with commons-logging, you'll have to take it up with them. BTW, I will be leaving for a mini vacation shortly, so someone else is probably going to have to take the reins on this one if you require more help. good luck! Jake At 11:11 AM 8/8/2003 -0400, you wrote: Actually that is the message I am getting (I just abbreviated it a bit). In my application the log4j.jar file does not exist in the common/lib directory of Tomcat. This file only exists in the web-inf/lib directory of my application. Could this be attributed to my environmental settings: .;E:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\ldap.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jndi.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\fscontext.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar; E:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8;E:\istrobe20jars\dom4j.jar; E:\Tomcat 4.1\common\lib\servlet.jar; E:\Tomcat 4.1\bin\bootstrap.jar; E:\Sandbox\build\classes; C:\j2sdk1.4.1_01\bin; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\ant.jar; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\optional.jar Thanks for hanging in there. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List There doesn't appear to be anything wrong with your log4j.xml (except that you should use level rather than priority, but that isn't the issue here). Note that the error you've mentioned in previous emails is not an issue here... Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I'd bet that goes away if you remove log4j.jar from CATALINA_HOME/common/lib (please test this out). Having log4j.jar in WEB-INF/lib of your application provides for a separate logging environment since it is in a distinct classloader. I'm at a loss as to why you are not seeing debug message? You are running code that does logger.debug(), right? Anyone else have a clue what is happening here? Jake At 09:49 AM 8/8/2003 -0400, you wrote: Can anyone see anything wrong with this log4j.xml file? For some reason I cannot get lof4j to initialize and it's driving me crazy. I am sure it is something I am doing wrong but I can't seem to locate the problem. The error message I am getting is: No appenders could be found for logger. Please initialize the log4j system properly . Here is the
RE: Separate configs for different webapps
Howdy, Yes. Instead of them sharing log4j.jar, put a copy of the jar in each app's WEB-INF/lib folder. Then keep the separate config files as you've done, in each app's WEB-INF/classes folder. Make sure there's no log4j.jar in tomcat's common/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:37 PM To: [EMAIL PROTECTED] Subject: Separate configs for different webapps Hi, I am probably asking a stupid question here because I am new to log4j and tomcat. I have two webapps running under tomcat (single JVM) that are sharing common libraries. I am trying to find a way to set up the logging properties such that the two webapps have different settings (i.e., different appenders, layouts, levels, etc.). I've tried putting a log4j.properties file in the classes directory for each of my webapps, but it seems it only automatically picks up the one associated with whichever webapp is started first by tomcat (the other one is never loaded). If I put an explicit call in both webapps to the PropertyConfigurator, it seems that whichever one loads last overwrites the previous settings. Can I get different settings for each of my webapps somehow? Pat Grever Software Development Engineer iIPS Connectivity - Management Applications Lab Phone: 208.396.2522 Fax: 208.396.4796 [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do i get Log4j in Tomcat environment?
At 12:24 PM 8/7/2003 -0400, you wrote: Jake, Thanks for your thoughts. I do have the log4j.jar file in the CATALINA_HOME/common/lib and the WEB-INF/classes as well. I assume you meant WEB-INF/lib, not WEB-INF/classes. The latter is the place for log4j.xml while the former is the place for log4j.jar. I am not getting any logging either. The application is supposed to write to a file and does not. I'd have to verify that you have things set up right by looking at your log4j.xml file. The problem appears to be that log4j is not starting due to the before mentioned error (i.e. the appender missing). No, that is a totally separate problem. If you actually do have log4j.jar in WEB-INF/lib, then your application logging environment is completely and utterly separated from the one Tomcat is using. Since there is no interaction, the error you see can't be causing the error unless you have other libraries which are (improperly) configuring log4j without your realizing it and, thus, overriding your configuration. Do you use commons-logging or log4j directly? What other libraries do you have in your webapp? I also have the application writing to the console just so that I can see if log4j is initializing upon startup. You probably won't see default initialization unless you have debug=true in log4j.xml. Try that. Try also setting the root logger to a level of debug so that you can be assured that your classes are actually debugging. Jake Let me know if you have any additional thoughts. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 11:38 AM To: Log4J Users List I see that error in Tomcat5 as well. I assume you have log4j.jar in CATALINA_HOME/common/lib? Did you also add log4j.jar to WEB-INF/lib of your application? If not, do that and make sure your log4j.xml is in WEB-INF/classes. Everything should work fine for you. The error is inconsequential. When commns-logging (which Tomcat uses) finds log4j.jar, it uses it but there seems to be something wrong with the way they are configuring it. It shouldn't affect your application in the least. Just ignore the message. Having log4j.jar in WEB-INF/lib gives you a completely separate logging environment than that of the server. BTW, are you not getting any logging from your application? You should be if you have things configured correctly as I've described above. Jake At 09:57 AM 8/7/2003 -0400, you wrote: I am getting a startup error now on Log4J that is hopefully leading me to a solution. The error is: Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I am currently running Tomcat 4.1.27 on XP-Pro. I checked the log4j.xml file and it includes the necessary appenders. Does anyone know what may be causing this error. Thanks. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 2:58 PM To: Log4J Users List What exactly is the current problem you are having? Just add log4j.jar to WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you are ready to go. There are a couple of other options that are more advanced, but this should get you going for now. Jake At 06:39 PM 8/6/2003 +0100, you wrote: Hi, Trying to use log4j in Tomcat environment. Seen loads of messages on this but haven't got Much useful stuff from them. Could someone direct me to an appropriate resource. Thanks KB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: New issue on Log4J initialization
Yes it is a clean install (version 5.0). I decided that since I could get logging to work with v4.1.27 that I would re-try v5.0 again. One thing that I noticed was that there was log4j path information in my classpath, so I took that out. I rebooted the machine and tried to start Tomcat again. I got the same appender messages. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 2:49 PM To: Log4J Users List What version of Tomcat are you using? And is it a clean install? That is, a stock install with nothing else added to it. Jake At 02:10 PM 8/11/2003 -0400, you wrote: Jake, Before I go on I want to thank you for all your help and patience. I decided to test something out and totally removed my application and all instances of our log4j-1.2.8 jar file. Guess what happens? I still get the error: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. What are your thoughts about this? Thanks again. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 10:45 AM To: Log4J Users List At 09:25 AM 8/11/2003 -0400, you wrote: Jake, Having done as you said I am now getting a log file generated Glad you got things going. What do you think was the difference? Can you pinpoint the one change that made things start working? It would be good to know for future users having the same or similar problems. , although I still get the original error message from Tomcat: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. Any way to get that message to stop displaying? Did you put a copy of log4j.jar back into common/lib? That error is coming from commons-logging finding Log4j and using it in preference to j2sdk1.4.x logging, but if Log4j doesn't, then, find its configuration, you will get that error. Note that commons-logging does a bunch of classloading trickery to find and load external logging packages. It is entirely possible that it might be using the context class loader to find Log4j, thus being able to bypass the normal Java2 classloader hierarchy (where only classloader higher in the hierarchy are visible). However, I just tested having log4j.jar in my WEB-INF/lib and not in common/lib and commons-logging in common/lib couldn't see it (and, therefore, didn't get the Log4j error), so it is most likely that you have log4j.jar in common/lib (or shared/lib) or some other place where commons-logging in Tomcat can see log4j.jar. Remove Log4j.jar and you won't see that erroror, I suppose, you could add log4j.xml or log4j.properties to common/classes and all would be well. Jake -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 2:05 AM To: Log4J Users List Hi Timothy, This is why, when possible, I install apps manually by simply unzipping them to a directory rather than running some fancy install which I have no control over. I do this with Tomcat. I suppose this isn't possible with current versions of Websphere, but they really shouldn't be modifying your classpath anyway. I'd send them a complaint about this so that they stop this practice in the future. Their batch scripts should set everything up dynamically rather than modify the system CLASSPATH variable. Anyway, you can achieve this yourself by opening a command prompt and doing: set CLASSPATH . Now run Tomcat from there (although the default scripts should ignore the classpath anyway, now that I think about it). Anyway, try that out. If that doesn't help, maybe if you have a sample application you can send to me, I can test it out myself to see if I get logging or not. Some source code would also be good so I know where to expect logging statements to come from. Jake At 01:27 PM 8/8/2003 -0400, you wrote: Keith, The problem I have with removing all that stuff is that 90% of it was put there by applications. Should I remove parts of it anyway? I guess that's where my confusion is since (as I said) most of these variables were entered by the installation of the applications themselves. Thanks for your thoughts Keith! -Original Message- From: Keith Hatton [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:18 PM To: Log4J Users List single period = . = class files etc. based on this directory only. It's just that the CLASSPATH environment variable often does more harm than good. If you use java -cp something then the CLASSPATH is ignored, and often scripts that start Java apps will do just that. But then again, sometimes they add your CLASSPATH to theirs. That's when the trouble starts ... So basically, Jake's advice is, remove your CLASSPATH environment variable if at all possible.
RE: how do i get Log4j in Tomcat environment?
Can anyone see anything wrong with this log4j.xml file? For some reason I cannot get lof4j to initialize and it's driving me crazy. I am sure it is something I am doing wrong but I can't seem to locate the problem. The error message I am getting is: No appenders could be found for logger. Please initialize the log4j system properly . Here is the log4j file: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd !-- For Ant build -- log4j:configuration !-- order of elements: renderer*, appender*, (category | ...) , root -- appender name=LF5 class=org.apache.log4j.lf5.LF5Appender param name=MaxNumberOfRecords value=1000/ /appender appender name=file class=org.apache.log4j.RollingFileAppender param name=file value=build.log/ param name=maxBackupIndex value=3/ param name=maxFileSize value=100KB/ layout class=org.apache.log4j.TTCCLayout/ /appender !-- if using this in ant, be sure the java mail libraries are avaiable -- appender name=mail class=org.apache.log4j.net.SMTPAppender param name=Threshold value=debug/ param name=SMTPHost value=bh1.compuware.com/ param name=bufferSize value=1/ param name=to value=[EMAIL PROTECTED]/ param name=from value=[EMAIL PROTECTED]/ param name=subject value=Ant test/ layout class=org.apache.log4j.HTMLLayout/ /appender appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%t] %C{2} (%F:%L) - %m%n/ /layout /appender root priority value=debug / appender-ref ref=STDOUT / appender-ref ref=file/ !-- appender-ref ref=mail/ -- !-- appender-ref ref=LF5/ -- /root /log4j:configuration Thank you for your help. The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with JDBCAppender
No one has these problems using the JDBCAppender? On Wed, 06 Aug 2003 15:42:47 +0550, Milind Rao wrote: I created a subclass of JDBCAppender for logging to the database and am running into the following problems. I'd apreciate if someone who's been using this can shed some light on them. 1. Unless the Buffer Size is 1 (or less than the number of logs being written), the logs don't make it to the database. The getLogStatement method is never called. 2. This problem may be related to the buffer size problem above. but if I set the buffer size to say 2 and create one log and exit the program, the finalize method of JDBCAppender doesn't get called and the logs don't get flushed to the database. 3. There should be a commit parameter for the JDBCAppender. Incidentally there is a related bug somewhere that I haven't had the time to track down. If I don't set AutoCommit to true on the connection, prior to returning it from the getConnection method, the database hangs while accesing the Log table. This is with DB2. I don't know exactly where the problem lies. But since I did want to set AutoCommit to true, I didn't spend the time following up. 4. In my data access classes, I normally set AutoCommit to false and do my own commits after successful completion of the SQL call. In case of an exception, I do a rollback. If I don't do a rollback on error, then the next (unrelated) successful call to the database commits the earlier failed SQL. Doesn't one need to do a rollback when auto commit is set to true? If not, then it's missing in JDBCAppender's execute method. I'm thinking of just redefining the execute method instead of the getConnection and closeConnection methods. 5. If the appender I use in the fallback error handler is also used by the root logger, then an arrayIndexOutOfBoundsException exception is thrown while accesing the appenderList in the appendLoopOnAppenders method of AppenderAttachableImpl. ie. if the error handler for JDBCAppender is Console and Console is also used as an appender in root, then this exception is thrown when the fallback appender is used. As an aside, the documentation is really bad. It took me ages to find that I had to use root-ref/ to set the root logger as the fallback appender. I really think we should move to a schema based XML configuration rather than a DTD based. 6. If I have 2 appenders in root, an exception is thrown while writing to the database and the fallback handler is called, the first log doesn't show up in the second appender in root. In my configuration file below, the first log shows up in the file (fallback of database appender) but doesn't show up on the console. If the appenders are reversed, then it doesn't show up in the file, but shows up on the console. This happens only with the log that was being written to the database when the exception occurred. The remaining logs show up fine in both appenders. ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; !-- Database Appender -- appender name=BSDBAppender class=brickstream.logging.model.BSDBAppender !-- fallback on error -- errorHandler class=org.apache.log4j.varia.FallbackErrorHandler root-ref/ appender-ref ref=BSFileAppender/ /errorHandler param name = BufferSize value =1/ /appender !-- Secondary File Appender -- appender name=BSFileAppender class=brickstream.logging.model.BSFileAppender param name = LogFileSuffix value =.log/ layout class=brickstream.logging.model.BSLayout/ /appender !-- Console Appender -- appender name=Console class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%-5p] %m %n / /layout /appender root level value=debug/ appender-ref ref=BSDBAppender/ appender-ref ref=Console/ /root /log4j:configuration Regards Milind Regards Milind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JBoss/EAR/JARs.. log4j not working.. location of the war files..
Hi all. I am porting a web application from Tomcat to JBoss, and therefore from WAR to EAR, and which includes some EJB JARs. This application used commons-logging on top of log4j to do its logging. I didnt change anything in the logging configuration and the location of the propreties files, but it is not working (i dont want to use the log4j.xml under JBoss). commons-logging.properties and log4j.properties are in app.ear/webapp.ear/WEB-INF/classes/ (i even tried to change their locations to default/lib and other places and still it is not working) with the following entries: commons-logging.properties: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL ogger log4j.properties: log4j.rootLogger=DEBUG, stdout, rolling log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m% n log4j.appender.rolling=org.apache.log4j.RollingFileAppender log4j.appender.rolling.File=D:\\cbclog.txt log4j.appender.rolling.MaxFileSize=200KB log4j.appender.rolling.MaxBackupIndex=10 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p % c - %m%n Do I need to do make any changes in the configuration and/or the location of the properties files, or any other JBoss-specific configuration? the deployment is using an exploded EAR, which includes exploded WAR and JAR.. I have tried to move the preperties files to many locations with no sucess.. in case of Tomcat they were in WAR file and the properties files (log4j/commons-logging) were under WEB- INF/classes/ but now with EAR file under JBOSS where the files should be placed?.. thanks.. Thank you in advance.. R Rabih - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
log4j: dump wrap-around buffer of all log messages
Dear log4j users, Currently I'm evaluating log4j 1.2.8 to replace an other Java Trace package (see http://visibleworkings.com/trace/) in our applications. Log4j's big advantage is its performance, but still I'm missing a feature that is present in the Java Trace package: the ability to dump a wrap-around buffer of, let's say, the last 500 log messages in the log file. The wrap-around buffer (think of it as an array of let's say 500 log messages) contains at any moment, the last 500 log messages. The idea is that the logger has 2 log levels: one which determines what level is present in the log file (or std out or whatever), another which determines at what level the internal wrap-around buffer is filled with messages. This way, it is possible to let your application log at level INFO, while the internal buffer keeps all messages of level DEBUG or higher. When an exception is thrown, the user should have the ability to request a dump of the buffer, such that the more detailed DEBUG messages are also present in the log file to make debugging more easy. Is this possible in log4j? If not, has anyone a workaround for this or should I ask for a feature request? Kind regards, Patrick Hancke Siemens Atea IC D BS PD2 tel ++32(0)14 - 25 24 27 fax ++32(0)14 - 25 30 25 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Using customized filters in JBoss3.0.6
hi, the filters class is org.apache.log4j.varia.Filter Name, I mean whichever filter u want to use. regards -Original Message- From: Abramson, Rami [SMTP:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 3:37 PM To: Log4j-User (E-mail) Subject: Using customized filters in JBoss3.0.6 Hello, We work with JBoss3.0.6. Have written some customized filters in my project and configured the log4j.xml to use them in the ConsoleAppender. JBoss complains for not recognizing the Filter class: java.lang.NoClassDefFoundError: org/apache/log4j/spi/Filter Without the filters definition in the log4j.xml it works fine. The actual log4j.jar that JBoss seems to use, does contain the required class. What am I missing ? thank you, Rami A. NOTICE: This communication contains information which may be proprietary, privileged or confidential. If you are not the intended recipient (or authorized to receive for the intended recipient), or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, disclose or otherwise use the information. Also, please indicate to the sender that you have received this communication in error and delete the copy you received. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Comments and Questions section of your book
On a related topic, I was going to buy the book, but was wondering if a newer edition will be released shortly with changes in log4j 1.3. One thing I hate is reading a technical book and then having to read it all over again, because some stuff changed in how I should go about. Can't be helped in our field except in a case like this with a new version imminent. I'm especially interested in the adapters and the JDBCAppender which may change. On Wed, 06 Aug 2003 11:09:27 +0200, Ceki Glc wrote: Craig, I could have indeed dwelled more on SocketAppender and discussed the SockerServer application instead of just SimpleSocketServer. I believe SockerServer was omitted because it was considered as uninteresting and/or too technical. Indeed, SockerServer relies on multiple LoggerRepository instances, a concept introduced only in later chapters. Anyway, I am taking note of your comment and will accommodate your request in later editions. As for your message, if it was sent on the mailing list than it should be in the archives. We do not remove or censor messages, except what is blatantly spam devoid of any relation to log4j or logging. At 09:10 AM 8/6/2003 +0100, craig ryan wrote: Hello Ceki, I did not see a response to this from you, I'm quite interested to know if this is an area you intend to cover in future publications? I also cannot locate my first email on the log4j archive, has it been removed for some reason? regards, craig. Hello Ceki, I have just obtained a copy of your log4j book (Feb 2003, first edition) with a specific interest in remote logging. I'm curious to know why the book briefly covers SocketAppender while offering little discussion of possible server side implementations beyond mention of the command line driven SimpleSocketServer example? Similarly, I noticed SocketNode and SocketServer classes in the 1.2.8 javadoc though no mention of either in the book, at least not in the index or any of the sections of the book which I've covered so far. Perhaps I've missed them, any pointers to the relevent material would be appreciated. BTW, under http://jakarta.apache.org/log4j/docs/api/ the sample XML file links under org.apache.log4j.xml.examples.XMLSample do not appear to be valid links at present. regards, craig. -- Craig Ryan, Principal Engineer, Network365 Glencormack Business Park, Kilmacanogue, Co. Wicklow, Ireland tel +353 1 2764500 fax +353 1 2764533 web www.network365.com -- Network365 enables the mobile lifestyle with mzone, a secure payments, personalization and identifiction platform. Winner of Best Wireless Application Developer Award, GSM Association Awards 2002 -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Regards Milind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how do i get Log4j in Tomcat environment?
What exactly is the current problem you are having? Just add log4j.jar to WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you are ready to go. There are a couple of other options that are more advanced, but this should get you going for now. Jake At 06:39 PM 8/6/2003 +0100, you wrote: Hi, Trying to use log4j in Tomcat environment. Seen loads of messages on this but haven't got Much useful stuff from them. Could someone direct me to an appropriate resource. Thanks KB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do i get Log4j in Tomcat environment?
Looks like that didn't make it either. Not sure why? You can send it directly to me. Just grab my email from the mail headers. Or you can just copy and paste it directly into the email rather than have it as an attachment. That might be better so others can see it as well. Jake At 03:20 PM 8/7/2003 -0400, you wrote: Sorry about that. Here you go. Thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 3:17 PM To: Log4J Users List If you want to attach something to the list, put it in a zip file first and attach that. Other attachments are rejected. Jake At 02:20 PM 8/7/2003 -0400, you wrote: Jake, Here is a copy of my log4j.xml file. Let me know if you see anything unusual or that may be contributing to my problems. I did mean that my log4j.jar file is in the WEB_INF/lib directory. Everything is where is belongs. Thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 12:50 PM To: Log4J Users List At 12:24 PM 8/7/2003 -0400, you wrote: Jake, Thanks for your thoughts. I do have the log4j.jar file in the CATALINA_HOME/common/lib and the WEB-INF/classes as well. I assume you meant WEB-INF/lib, not WEB-INF/classes. The latter is the place for log4j.xml while the former is the place for log4j.jar. I am not getting any logging either. The application is supposed to write to a file and does not. I'd have to verify that you have things set up right by looking at your log4j.xml file. The problem appears to be that log4j is not starting due to the before mentioned error (i.e. the appender missing). No, that is a totally separate problem. If you actually do have log4j.jar in WEB-INF/lib, then your application logging environment is completely and utterly separated from the one Tomcat is using. Since there is no interaction, the error you see can't be causing the error unless you have other libraries which are (improperly) configuring log4j without your realizing it and, thus, overriding your configuration. Do you use commons-logging or log4j directly? What other libraries do you have in your webapp? I also have the application writing to the console just so that I can see if log4j is initializing upon startup. You probably won't see default initialization unless you have debug=true in log4j.xml. Try that. Try also setting the root logger to a level of debug so that you can be assured that your classes are actually debugging. Jake Let me know if you have any additional thoughts. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 11:38 AM To: Log4J Users List I see that error in Tomcat5 as well. I assume you have log4j.jar in CATALINA_HOME/common/lib? Did you also add log4j.jar to WEB-INF/lib of your application? If not, do that and make sure your log4j.xml is in WEB-INF/classes. Everything should work fine for you. The error is inconsequential. When commns-logging (which Tomcat uses) finds log4j.jar, it uses it but there seems to be something wrong with the way they are configuring it. It shouldn't affect your application in the least. Just ignore the message. Having log4j.jar in WEB-INF/lib gives you a completely separate logging environment than that of the server. BTW, are you not getting any logging from your application? You should be if you have things configured correctly as I've described above. Jake At 09:57 AM 8/7/2003 -0400, you wrote: I am getting a startup error now on Log4J that is hopefully leading me to a solution. The error is: Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I am currently running Tomcat 4.1.27 on XP-Pro. I checked the log4j.xml file and it includes the necessary appenders. Does anyone know what may be causing this error. Thanks. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 2:58 PM To: Log4J Users List What exactly is the current problem you are having? Just add log4j.jar to WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you are ready to go. There are a couple of other options that are more advanced, but this should get you going for now. Jake At 06:39 PM 8/6/2003 +0100, you wrote: Hi, Trying to use log4j in Tomcat environment. Seen loads of messages on this but haven't got Much useful stuff from them. Could someone direct me to an appropriate resource. Thanks KB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this e-mail are intended for the named
RE: Newbie how to place logfile under tomcat logs
I've done it! I was missing the first '/' i.e. URL url = this.getClass().getResource(/com/foo/bar/message.properties); -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 4:23 PM To: Log4J Users List Subject: RE: Newbie how to place logfile under tomcat logs Howdy, yeah, I'm using ant but I dont like the fact that it is hard-coded. It's not hard-coded, certainly not more hard-coded than a properties file. I think I'll use the properties file option, we have a properties file already I'll just add the log4j properties to that. I don't suppose you know how to load the properites file when it is in a JAR? because it says If the file is in a jar, use Class#getResource to get the URL to it. Don't use the File/IO approach. Then use PropertyConfigurator.configure(URL configURL) instead of configure(Properties p). You can also consider putting the properties file outside a jar, i.e. under WEB-INF, and using the ServletContext#getResource approach instead of Class#getResource. This way you can easily modify the properties file without having to repackage your jar. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Urgent... Log 4j 1.2.7 issue...
Not sure what the issue is, but why did you upgrade to 1.2.7? 1.2.8 is the latest and recommeded release. Jake At 11:04 AM 8/14/2003 -0700, you wrote: Hi All I was able to run log4j 1.1.3 version in my environment without any problems. Now when I updated my log4j to ver 1.2.7 and I boot my weblogic server I get the following error, log4j:WARN No appenders could be found for logger (ABC_FILE_1_0.Configuration). log4j:WARN Please initialize the log4j system properly. log4j:ERROR Attempted to append to closed appender named [FileAppender]. log4j:ERROR Attempted to append to closed appender named [ConsoleAppender]. Can you let me know what the problem could be? I know it is related to some configuration issue. Does it have to do with the fact that in 1.2.7 when we boot the server we have to mandatory mention the log4j:file location as -D option? Thanks Mayur. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do i get Log4j in Tomcat environment?
Sorry about that. Here you go. Thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 3:17 PM To: Log4J Users List If you want to attach something to the list, put it in a zip file first and attach that. Other attachments are rejected. Jake At 02:20 PM 8/7/2003 -0400, you wrote: Jake, Here is a copy of my log4j.xml file. Let me know if you see anything unusual or that may be contributing to my problems. I did mean that my log4j.jar file is in the WEB_INF/lib directory. Everything is where is belongs. Thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 12:50 PM To: Log4J Users List At 12:24 PM 8/7/2003 -0400, you wrote: Jake, Thanks for your thoughts. I do have the log4j.jar file in the CATALINA_HOME/common/lib and the WEB-INF/classes as well. I assume you meant WEB-INF/lib, not WEB-INF/classes. The latter is the place for log4j.xml while the former is the place for log4j.jar. I am not getting any logging either. The application is supposed to write to a file and does not. I'd have to verify that you have things set up right by looking at your log4j.xml file. The problem appears to be that log4j is not starting due to the before mentioned error (i.e. the appender missing). No, that is a totally separate problem. If you actually do have log4j.jar in WEB-INF/lib, then your application logging environment is completely and utterly separated from the one Tomcat is using. Since there is no interaction, the error you see can't be causing the error unless you have other libraries which are (improperly) configuring log4j without your realizing it and, thus, overriding your configuration. Do you use commons-logging or log4j directly? What other libraries do you have in your webapp? I also have the application writing to the console just so that I can see if log4j is initializing upon startup. You probably won't see default initialization unless you have debug=true in log4j.xml. Try that. Try also setting the root logger to a level of debug so that you can be assured that your classes are actually debugging. Jake Let me know if you have any additional thoughts. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 11:38 AM To: Log4J Users List I see that error in Tomcat5 as well. I assume you have log4j.jar in CATALINA_HOME/common/lib? Did you also add log4j.jar to WEB-INF/lib of your application? If not, do that and make sure your log4j.xml is in WEB-INF/classes. Everything should work fine for you. The error is inconsequential. When commns-logging (which Tomcat uses) finds log4j.jar, it uses it but there seems to be something wrong with the way they are configuring it. It shouldn't affect your application in the least. Just ignore the message. Having log4j.jar in WEB-INF/lib gives you a completely separate logging environment than that of the server. BTW, are you not getting any logging from your application? You should be if you have things configured correctly as I've described above. Jake At 09:57 AM 8/7/2003 -0400, you wrote: I am getting a startup error now on Log4J that is hopefully leading me to a solution. The error is: Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I am currently running Tomcat 4.1.27 on XP-Pro. I checked the log4j.xml file and it includes the necessary appenders. Does anyone know what may be causing this error. Thanks. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 2:58 PM To: Log4J Users List What exactly is the current problem you are having? Just add log4j.jar to WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you are ready to go. There are a couple of other options that are more advanced, but this should get you going for now. Jake At 06:39 PM 8/6/2003 +0100, you wrote: Hi, Trying to use log4j in Tomcat environment. Seen loads of messages on this but haven't got Much useful stuff from them. Could someone direct me to an appropriate resource. Thanks KB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
Re: Location of log files
Have you tried using system properties? Log4j performs variable substitution in XML files as well. At 01:44 PM 8/5/2003 -0400, Grum Ketema wrote: Hello I could not find a simple solution to this problem. I deploy a web application (a War file) in a web server (iplanet) and an ejb application ( an ear file) in OAS (oracle application server). I want to use log4j in both applications. The logging works fine. The problem is specifying the location of the log file. I use log4j.xml to configure log4j. In there I have to specify the location of the log file as absolute path. This creates a problem because we have to edit log4j.xml during each deployment of our application to edit the location of the log file. I attempted to solve the problem by adding the following code in a utility class rootLogger = Logger.getRootLogger(); FileAppender fp = (FileAppender) rootLogger.getAppender(LOGFILE); String fileName = fp.getFile(); String dir = getOracleRootDir(); if (dir!=null) { StringBuffer logFilePath = new StringBuffer(dir); logFilePath.append(File.separator+log+File.separator+fileName); fp.setFile(logFilePath.toString()); fp.activateOptions(); } which is kind of clumsy. Is there any way of specifying the location of the log file without editing log4j.xml (e.g. programmatically or otherwise) Regards, Grum -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating log files relative to the web applications root directory?
G'day, U, so basically then it is not possible to define a directory path in the log4j.xml properties file so that log files are placed relative to the web apps root directory? Or for that matter relative to any known anchor point like the server root directory? A problem we have is that we deploy .war files by sending the package to the server gods who then drop it into the webapps directory. Alas we don't have the rights to deploy directly to the server environment and tools like ANT whilst are good at building a distributable archive they do not quite make the grade when resolving tokens in a dynamic style of deployment. Another issue we have is that most of the development work is done on a Windows based machine and the production servers are hosted on a flavor of Unix. Hard coding a directory path like C:\..\ may work when doing the dev work under Windows but just don't kind of cut it on a Unix file system when it comes time to deployment. BTW, the last time I looked me was male so I'll opt out for king! AB -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, 11 August 2003 11:14 PM To: Log4J Users List Subject: RE: Creating log files relative to the web applications root directory? Howdy, I suppose Adrian could be a woman's name as well, so you're right ;) AmendedVersion But if you're the server admin, you're king (or queen) ;) /AmendedVersion Yoav Shapira Millennium ChemInformatics -Original Message- From: Caroline Wood [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:13 AM To: 'Log4J Users List' Subject: RE: Creating log files relative to the web applications root directory? or Queen! lol ;) -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 11 August 2003 14:05 To: Log4J Users List; [EMAIL PROTECTED] Subject: RE: Creating log files relative to the web applications root directory? Howdy, What I've seen done to achieve this is have my ant deployment script fill the value when copying log4j.xml over. So in log4j.xml, you'd have param name=File value=@logFilePath@ / And in your ant script, you set filtering=true when copying log4j.xml, and replac the logFilePath token with the actual (absolute) path. As an aside, note that the servlet container is not required to give you write access under your webapp's root. In fact, many server admins dislike this, as they prefer a centralized log location for their systems. But if you're the server admin, you're king ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Adrian Beech [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 6:42 AM To: 'Log4J Users List' Subject: Creating log files relative to the web applications root directory? G'day, Is it possible to specify a log filename in the XML log4j properties file so that it is relative to the web applications root directory? I have the following in a log4j.xml file located in web-inf/classes with the log4j jar in the web-inf/lib directory. Logging seems to be fine except the rascal.log file is being created in the Tomcat application directory under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory tree. I'd prefer to have the log files in something like ../webapps/application/logs/logfilename. Is this possible? BTW, took a while to find the rascal.log file!!! --[log4j.xml]- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=rf class=org.apache.log4j.RollingFileAppender param name=file value=rascal.log/ param name=maxBackupIndex value=2/ param name=maxFileSize value=250KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{dd/MM/ HH:mm:ss} %-5p (%t) %l - %m%n/ /layout /appender root priority value=debug / appender-ref ref=rf/ /root /log4j:configuration --[End Of File]--- I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and Tomcat 4.1.24 on a Unix box as the production platform. AB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: discreet logging types - revisited
Howdy, I'm a fan of the Level system and its relationship, so no I'm not interested in your suggested mods, but I wanted to throw out an idea or two for you that might reduce the need for coding: - Can you use separate logger repositories as your types ? - Can you use a Filter attached to the root logger that matches based on type as an MDC attribute of the logging event? Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 3:10 PM To: [EMAIL PROTECTED] Subject: discreet logging types - revisited Hi all, Well, I'm still looking at how to use discreet logging types instead of the Level to control what messages are enabled. The difficulty resides in the need to enable/disable certain log types by package/class name. BTW, I posted my original message on 7/30/03 if you are interested. Basically, the way I've always built logging systems is by defining a set of discreet types to be used by the developers, and then allowed those types to be enabled/disabled individually. Unfortunately the level concept is fairly hard-wired into log4j. I say unfortunately not because levels are bad, but because there is no way to expand or get-around them with an alternate approach. Actually, levels can be viewed as a set of discreet types with an implicit ordering/relationship between them, but in log4j, there is no way to control the relationship test. Before I go on too much (which I do!), is there anyone else who is interested in discussing the idea of replacing the level with discreet types in the log4j package?? Basically I'm at a point where I need to make some decisions regarding how to proceed. If other members are interested in pursuing this idea, then I'll explore the idea of modifying the Logger classes (et. al.) to replace the level with types, with the intention of folding those changes back into the product. But if no one is interested, I'll just make some small mods to Logger for my own purposes and handle it as a one-off type situation. In either case, I intend to move forward with log4j! It has many features which I'm planning to use in the future (like that IMAppender being discussed!!). Mostly its a matter of whether I do a complete implementation to replace levels, or just a quick fix to solve my problems. Thoughts, comments ??? Ceki, as one of the main champions for log4j, do you have any input? --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
discreet logging types - revisited
Hi all, Well, I'm still looking at how to use discreet logging types instead of the Level to control what messages are enabled. The difficulty resides in the need to enable/disable certain log types by package/class name. BTW, I posted my original message on 7/30/03 if you are interested. Basically, the way I've always built logging systems is by defining a set of discreet types to be used by the developers, and then allowed those types to be enabled/disabled individually. Unfortunately the level concept is fairly hard-wired into log4j. I say unfortunately not because levels are bad, but because there is no way to expand or get-around them with an alternate approach. Actually, levels can be viewed as a set of discreet types with an implicit ordering/relationship between them, but in log4j, there is no way to control the relationship test. Before I go on too much (which I do!), is there anyone else who is interested in discussing the idea of replacing the level with discreet types in the log4j package?? Basically I'm at a point where I need to make some decisions regarding how to proceed. If other members are interested in pursuing this idea, then I'll explore the idea of modifying the Logger classes (et. al.) to replace the level with types, with the intention of folding those changes back into the product. But if no one is interested, I'll just make some small mods to Logger for my own purposes and handle it as a one-off type situation. In either case, I intend to move forward with log4j! It has many features which I'm planning to use in the future (like that IMAppender being discussed!!). Mostly its a matter of whether I do a complete implementation to replace levels, or just a quick fix to solve my problems. Thoughts, comments ??? Ceki, as one of the main champions for log4j, do you have any input? --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Urgent... Log 4j 1.2.7 issue...
I know but we need to stick to 1.2.7 will be upgrading later to 1.2.8. I tried 1.2.8 and faced the same issue. I know it is not a log4j per se issue, it is something to do with packaging. Any idea on what was added in 1.2.x versions that was mandatory. Thanks a lot, Mayur. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 11:44 AM To: Log4J Users List Subject: Re: Urgent... Log 4j 1.2.7 issue... Not sure what the issue is, but why did you upgrade to 1.2.7? 1.2.8 is the latest and recommeded release. Jake At 11:04 AM 8/14/2003 -0700, you wrote: Hi All I was able to run log4j 1.1.3 version in my environment without any problems. Now when I updated my log4j to ver 1.2.7 and I boot my weblogic server I get the following error, log4j:WARN No appenders could be found for logger (ABC_FILE_1_0.Configuration). log4j:WARN Please initialize the log4j system properly. log4j:ERROR Attempted to append to closed appender named [FileAppender]. log4j:ERROR Attempted to append to closed appender named [ConsoleAppender]. Can you let me know what the problem could be? I know it is related to some configuration issue. Does it have to do with the fact that in 1.2.7 when we boot the server we have to mandatory mention the log4j:file location as -D option? Thanks Mayur. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
LogManager-error?
Hi I have created a wrapper to Logger and here follows some code from that wrapper class (ExceptionCategory): private Logger logger; . public ExceptionCategory(String arg1) { logger = logger.getLogger(arg1); } Unfortunatly I get a runtime-exception when the ExceptionCategory-constructor is run: Servlet Error: #40;class: org/apache/log4j/LogManager, method: lt;clinitgt; signature: #40;#41;V#41; Incompatible argument to method: java.lang.VerifyError: (class: org/apache/log4j/LogManager, method: clinit signature: ()V) Incompatible argument to method The LogManager-class is called from the Logger-class and this is probably the first time LogManager is run on the server (clinit = class init?). I have thought of a number of possible causes (classpath-issues, property-configuration-errors and so on) but I have not been able to pinpoint the error to one of those, neither do I find it reasonable because the error-message seems pinpoint the error to the LogManager-class itself! I am using log4j1.2.5 and I am pretty sure that there are no errors in LogManager (or Logger) in this version, so what am I missing? Btw: Is the error-message clear to everyone? Or is it approriate of me to ask for better error-messages? mvh Morten Simonsen- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Separate configs for different webapps
Howdy, Thanks Jake for adding the links: your solution will work, I've tried it myself in the past. That said, I fully agree with Senor Coast's advice to not share jars across webapps, even if they're exactly the same. Keep all the jars for your webapp, including common ones, in WEB-INF/lib. Or just deploy as one WAR file. Webapps are supposed to be self-contained, and you will save yourself many configuration and debugging hassles if you stick to this principle. Yoav Shapira Millennium ChemInformatics -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 1:53 AM To: Log4J Users List Subject: RE: Separate configs for different webapps This should be possible using separate logger repositories per/webapp. Please see: http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppConta iner Logging I've added a link to this in the wiki FAQ as well: http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/Frequent lyAs kedQuestions Jake At 01:50 PM 8/8/2003 -0700, you wrote: Follow on question... Some of my code is shared among several webapps. We've been installing the jar files in the tomcat shared/lib directory. I'd like the log messages from these shared components to use the same logging configuration as the specific webapp that is calling them is using. Essentially things running on a particular thread (and child threads it starts) would use the same log configuration. If I use the solution mentioned (i.e., putting the log4j.jar in the webapp's classes directory), it seems like this will only cause the classes associated with the webapp to use the logging configuration? In other words, won't log calls from the shared jars use a different logging configuration than the webapp methods that are calling them? If this is a problem, then is there a way around it? It seems like I want some type of logging context that I can establish on a thread that defines ALL of the log settings, not just a name. Pat -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List Subject: RE: Separate configs for different webapps Howdy, Yes. Instead of them sharing log4j.jar, put a copy of the jar in each app's WEB-INF/lib folder. Then keep the separate config files as you've done, in each app's WEB-INF/classes folder. Make sure there's no log4j.jar in tomcat's common/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:37 PM To: [EMAIL PROTECTED] Subject: Separate configs for different webapps Hi, I am probably asking a stupid question here because I am new to log4j and tomcat. I have two webapps running under tomcat (single JVM) that are sharing common libraries. I am trying to find a way to set up the logging properties such that the two webapps have different settings (i.e., different appenders, layouts, levels, etc.). I've tried putting a log4j.properties file in the classes directory for each of my webapps, but it seems it only automatically picks up the one associated with whichever webapp is started first by tomcat (the other one is never loaded). If I put an explicit call in both webapps to the PropertyConfigurator, it seems that whichever one loads last overwrites the previous settings. Can I get different settings for each of my webapps somehow? Pat Grever Software Development Engineer iIPS Connectivity - Management Applications Lab Phone: 208.396.2522 Fax: 208.396.4796 [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please
Re: Comments and Questions section of your book
Craig, I could have indeed dwelled more on SocketAppender and discussed the SockerServer application instead of just SimpleSocketServer. I believe SockerServer was omitted because it was considered as uninteresting and/or too technical. Indeed, SockerServer relies on multiple LoggerRepository instances, a concept introduced only in later chapters. Anyway, I am taking note of your comment and will accommodate your request in later editions. As for your message, if it was sent on the mailing list than it should be in the archives. We do not remove or censor messages, except what is blatantly spam devoid of any relation to log4j or logging. At 09:10 AM 8/6/2003 +0100, craig ryan wrote: Hello Ceki, I did not see a response to this from you, I'm quite interested to know if this is an area you intend to cover in future publications? I also cannot locate my first email on the log4j archive, has it been removed for some reason? regards, craig. Hello Ceki, I have just obtained a copy of your log4j book (Feb 2003, first edition) with a specific interest in remote logging. I'm curious to know why the book briefly covers SocketAppender while offering little discussion of possible server side implementations beyond mention of the command line driven SimpleSocketServer example? Similarly, I noticed SocketNode and SocketServer classes in the 1.2.8 javadoc though no mention of either in the book, at least not in the index or any of the sections of the book which I've covered so far. Perhaps I've missed them, any pointers to the relevent material would be appreciated. BTW, under http://jakarta.apache.org/log4j/docs/api/ the sample XML file links under org.apache.log4j.xml.examples.XMLSample do not appear to be valid links at present. regards, craig. -- Craig Ryan, Principal Engineer, Network365 Glencormack Business Park, Kilmacanogue, Co. Wicklow, Ireland tel +353 1 2764500 fax +353 1 2764533 web www.network365.com -- Network365 enables the mobile lifestyle with mzone™, a secure payments, personalization and identifiction platform. Winner of ‘Best Wireless Application Developer’ Award, GSM Association Awards 2002 -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how do i get Log4j in Tomcat environment?
Hi, Trying to use log4j in Tomcat environment. Seen loads of messages on this but haven't got Much useful stuff from them. Could someone direct me to an appropriate resource. Thanks KB
Re: Re: Separate configs for different webapps
hi ,all: how can I send my questions to all of you ? Could you tell me ? Thanks~~ mqg - SOUVENIR --- . | Souvenir of China | | A Good Place for You | `-- http://www.souvenirchina.com -' mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie how to place logfile under tomcat logs
yeah, I'm using ant but I dont like the fact that it is hard-coded. I think I'll use the properties file option, we have a properties file already I'll just add the log4j properties to that. I don't suppose you know how to load the properites file when it is in a JAR? because it says in the log4j FAQ the log4j classes and the properties file are not within the scope of the same classloader.So, if you're having problems, try loading the class or resource yourself. what i've done already is: Properties p = new Properties(); FileInputStream fis; try { fis = new FileInputStream(com.foo.bar.message.properties); p.load(fis); } catch (Throwable t) { t.printStackTrace(); } PropertyConfigurator.configure(p); but its not picking up our file in the JAR -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 2:42 PM To: Log4J Users List Subject: RE: Newbie how to place logfile under tomcat logs Howdy, Thanks, thats a help but because of the setup of our application, I cant use the first two options, and I'd rather not define another properties file just to store ${CATALINA_HOME}/logs/logs.txt. Is there any way I can do it programatically? What are the other options? No. It would be against the spirit, if not the letter, or the servlet specification for a servlet to be able to find out such details about its container. Even the approaches I showed before weren't that portable. This is like those perennial how can I find out what port the server is running on in my servlet's init() method? (You can't with certainty/portability). Other options include adding a JNDI entry for your log file path into tomcat's server.xml and then doing a JNDI lookup in your servlet's init method, or mangling your log4j configuration together with tomcat's commons-logging configuration. The latter is just cruising for a bruising, and the former is too container-specific (requires modifying server.xml) for my preferences, so I didn't include them before. Typically the Ant option is the one I like best, but I guess you don't use Any to deploy/package your application? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trying to put logs under ${CATALINA_HOME}/logs/
Hi, Specifying ${catalina.base} or ${catalina.home} should work if you started tomcat using bin\startup.bat file as this script converts the environment variable CATALINA_HOME into a -D system property on the java command line. Log4J tries to resolve properties surrounded by ${ and } by calling System.getProperty on the value. This will not resolve environment variables, only java properties specified using -D See the javadoc on org.apache.log4j.helpers.OptionConvertor substVars method for more details If you start tomcat using the supplied windows shortcut which starts using bin\bootstrap.jar no system Properties get set by default. Hope this helps Andy -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 13 August 2003 16:55 To: Log4J Users List Subject: RE: Trying to put logs under ${CATALINA_HOME}/logs/ Howdy, log4j.appender.myAppender.File=c:/jakarta-tomcat-4.1.24/logs/my_log.txt but this doesn't: log4j.appender.myAppender.File=${CATALINA_HOME}/logs/my_log.txt Did you try $CATALINA_HOME (on unix) or for your case %CATALINA_HOME% since you're on NT? The syntax with the curly braces is for Ant. You're trying to access environment variables. it would appear that it completely ignores the ${CATALINA_HOME} variable, which I have checked is defined. can anyone suggest a reason for this? I tried it with ${catalina.base} which i saw somewhere but that doesnt work either. And it doesnt like ${file.separator} either. I'm running winNT. Same thing for file.separator, although I don't think that's always defined as it is in java. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Instant Logging Article
I hadn't seen it before. Really well written and informative article. I have a weak spot for SMTPAppender. (If you are not using it, you should.) I am still not 100% convinced, but this article makes a good case of why IMAppender might be preferable to SMTPAppender under certain circumstances. Thanks for forwarding it. At 09:08 AM 8/13/2003 -0400, you wrote: Howdy, Even though I'm sure many have seen it, I wanted to send a link to this interesting article: http://www-106.ibm.com/developerworks/java/library/j-instlog/ The article has an overview of log4j and details on how to implement a remote instant messages (IM) appender. Yoav Shapira Millennium ChemInformatics -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie how to place logfile under tomcat logs
Just use default initialization or use the InitContextListener that I created in the log4j-sandbox project.. http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging Jake At 03:48 PM 8/12/2003 +0100, you wrote: yeah, I'm using ant but I dont like the fact that it is hard-coded. I think I'll use the properties file option, we have a properties file already I'll just add the log4j properties to that. I don't suppose you know how to load the properites file when it is in a JAR? because it says in the log4j FAQ the log4j classes and the properties file are not within the scope of the same classloader.So, if you're having problems, try loading the class or resource yourself. what i've done already is: Properties p = new Properties(); FileInputStream fis; try { fis = new FileInputStream(com.foo.bar.message.properties); p.load(fis); } catch (Throwable t) { t.printStackTrace(); } PropertyConfigurator.configure(p); but its not picking up our file in the JAR -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 2:42 PM To: Log4J Users List Subject: RE: Newbie how to place logfile under tomcat logs Howdy, Thanks, thats a help but because of the setup of our application, I cant use the first two options, and I'd rather not define another properties file just to store ${CATALINA_HOME}/logs/logs.txt. Is there any way I can do it programatically? What are the other options? No. It would be against the spirit, if not the letter, or the servlet specification for a servlet to be able to find out such details about its container. Even the approaches I showed before weren't that portable. This is like those perennial how can I find out what port the server is running on in my servlet's init() method? (You can't with certainty/portability). Other options include adding a JNDI entry for your log file path into tomcat's server.xml and then doing a JNDI lookup in your servlet's init method, or mangling your log4j configuration together with tomcat's commons-logging configuration. The latter is just cruising for a bruising, and the former is too container-specific (requires modifying server.xml) for my preferences, so I didn't include them before. Typically the Ant option is the one I like best, but I guess you don't use Any to deploy/package your application? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating log files relative to the web applications root directory?
Howdy, U, so basically then it is not possible to define a directory path in the log4j.xml properties file so that log files are placed relative to the web apps root directory? Or for that matter relative to any known anchor point like the server root directory? A problem we have is that we deploy .war files by sending the package to the server gods who then drop it into the webapps directory. Alas we don't This is a typical scenario. As Senor Ebersole suggested, you would reach agreement with the server admins on a particular directory or other repository where you can log. You would then use the System property or JNDI approach I illustrated in previous messages in this thread, except they set the property (or setup server.xml for JNDI), not you. Your app should complain and/or use a default setup (BasicConfigurator.configure() for example) if this property is not found. based machine and the production servers are hosted on a flavor of Unix. Hard coding a directory path like C:\..\ may work when doing the dev work under Windows but just don't kind of cut it on a Unix file system when it comes time to deployment. Even if you didn't have a mixed system deployment, hard-coding is a bad idea ;) I would throw out one other type of option for this case: if you control some servers, but not the ones you deploy to, you could have your apps send logging messages to the servers you control, e.g. via a SocketAppender or JMSAppender, or JDBCAppender even. Then you can figure out how to persist the messages yourself. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j: dump wrap-around buffer of all log messages
Howdy, I don't see your point. If you put the logged messages to a circular buffer that holds say 16k messages at a time, then you won't have high memory usage just 16k*size of a logged message. Of course if your code if full of debug logging, then the program will be slow, but on the other hand will give you very valuable feedback in case of an exception/error. 16k times the size of a logged message can be large, first of all. Secondly, that amount might be multiplied many times by having a separate buffer for each logger. Secondly, I like to be able to make the tradeoff of performance versus information myself, i.e. via configuration and reconfiguration at runtime. I will not accept a system that always keeps an extra 16k messages in case there's an error. I'm not saying this feature is a completely bad idea. It can be useful in certain cases. However: - log4j is in a sweet spot performance-wise, and care should be taken to maintain that. - When someone is considering moving to log4j from another package, complaining of the other package's performance, and then asks to add a feature that seems like a performance hog to log4j, that's a red flag for me. I will be glad to be convinced otherwise by a benchmark, however... Yoav Shapira -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 3:29 PM To: Log4J Users List Subject: RE: log4j: dump wrap-around buffer of all log messages Howdy, I would really want this sort of feature benchmarked for memory use ;) Perhaps this is one of the reasons log4j has better performance than your current java trace kit ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:24 AM To: Log4J Users List Subject: Re: log4j: dump wrap-around buffer of all log messages Yes, this is certainly possible. The SMTPAppender works in a similar fashion. At 03:09 PM 8/11/2003 +0200, you wrote: Dear log4j users, Currently I'm evaluating log4j 1.2.8 to replace an other Java Trace package (see http://visibleworkings.com/trace/) in our applications. Log4j's big advantage is its performance, but still I'm missing a feature that is present in the Java Trace package: the ability to dump a wrap-around buffer of, let's say, the last 500 log messages in the log file. The wrap-around buffer (think of it as an array of let's say 500 log messages) contains at any moment, the last 500 log messages. The idea is that the logger has 2 log levels: one which determines what level is present in the log file (or std out or whatever), another which determines at what level the internal wrap-around buffer is filled with messages. This way, it is possible to let your application log at level INFO, while the internal buffer keeps all messages of level DEBUG or higher. When an exception is thrown, the user should have the ability to request a dump of the buffer, such that the more detailed DEBUG messages are also present in the log file to make debugging more easy. Is this possible in log4j? If not, has anyone a workaround for this or should I ask for a feature request? Kind regards, Patrick Hancke Siemens Atea IC D BS PD2 tel ++32(0)14 - 25 24 27 fax ++32(0)14 - 25 30 25 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended
RE: New issue on Log4J initialization
What version of Tomcat are you using? And is it a clean install? That is, a stock install with nothing else added to it. Jake At 02:10 PM 8/11/2003 -0400, you wrote: Jake, Before I go on I want to thank you for all your help and patience. I decided to test something out and totally removed my application and all instances of our log4j-1.2.8 jar file. Guess what happens? I still get the error: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. What are your thoughts about this? Thanks again. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 10:45 AM To: Log4J Users List At 09:25 AM 8/11/2003 -0400, you wrote: Jake, Having done as you said I am now getting a log file generated Glad you got things going. What do you think was the difference? Can you pinpoint the one change that made things start working? It would be good to know for future users having the same or similar problems. , although I still get the original error message from Tomcat: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. Any way to get that message to stop displaying? Did you put a copy of log4j.jar back into common/lib? That error is coming from commons-logging finding Log4j and using it in preference to j2sdk1.4.x logging, but if Log4j doesn't, then, find its configuration, you will get that error. Note that commons-logging does a bunch of classloading trickery to find and load external logging packages. It is entirely possible that it might be using the context class loader to find Log4j, thus being able to bypass the normal Java2 classloader hierarchy (where only classloader higher in the hierarchy are visible). However, I just tested having log4j.jar in my WEB-INF/lib and not in common/lib and commons-logging in common/lib couldn't see it (and, therefore, didn't get the Log4j error), so it is most likely that you have log4j.jar in common/lib (or shared/lib) or some other place where commons-logging in Tomcat can see log4j.jar. Remove Log4j.jar and you won't see that erroror, I suppose, you could add log4j.xml or log4j.properties to common/classes and all would be well. Jake -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 2:05 AM To: Log4J Users List Hi Timothy, This is why, when possible, I install apps manually by simply unzipping them to a directory rather than running some fancy install which I have no control over. I do this with Tomcat. I suppose this isn't possible with current versions of Websphere, but they really shouldn't be modifying your classpath anyway. I'd send them a complaint about this so that they stop this practice in the future. Their batch scripts should set everything up dynamically rather than modify the system CLASSPATH variable. Anyway, you can achieve this yourself by opening a command prompt and doing: set CLASSPATH . Now run Tomcat from there (although the default scripts should ignore the classpath anyway, now that I think about it). Anyway, try that out. If that doesn't help, maybe if you have a sample application you can send to me, I can test it out myself to see if I get logging or not. Some source code would also be good so I know where to expect logging statements to come from. Jake At 01:27 PM 8/8/2003 -0400, you wrote: Keith, The problem I have with removing all that stuff is that 90% of it was put there by applications. Should I remove parts of it anyway? I guess that's where my confusion is since (as I said) most of these variables were entered by the installation of the applications themselves. Thanks for your thoughts Keith! -Original Message- From: Keith Hatton [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:18 PM To: Log4J Users List single period = . = class files etc. based on this directory only. It's just that the CLASSPATH environment variable often does more harm than good. If you use java -cp something then the CLASSPATH is ignored, and often scripts that start Java apps will do just that. But then again, sometimes they add your CLASSPATH to theirs. That's when the trouble starts ... So basically, Jake's advice is, remove your CLASSPATH environment variable if at all possible. Certainly that sounds like way too much junk in there. Hope this helps Keith -Original Message- From: Farrell, Timothy [mailto:[EMAIL PROTECTED] Sent: 08 August 2003 17:00 To: Log4J Users List Subject: RE: New issue on Log4J initialization Can you (or someone)explain your first statement (I'd change your classpath to be no more than a single period)? I have both installed on my machine however, I only run one at a time depending on what I am working on. My app does not use struts or anything else
Multiple loggers with different level problem
I've run into a problem with having different log levels for to (or more) loggers on the same branch in logger hierarchy. It seems that even if the parent logger level is set to OFF, it logs all messages that its child logs. Example: logger name=implementation level value=OFF / appender-ref ref=Console / /logger logger name=implementation.com.metro.telenor.test.MetroLogTestClientOtherClass level value=ON / appender-ref ref=Chainsaw / /logger ...will log to both Console and Chainsaw. Is it possible to get around this behaviour? Have I missed a point somewhere? Is it a bug? Regards Geir Antonsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie how to place logfile under tomcat logs
Howdy, Thanks, thats a help but because of the setup of our application, I cant use the first two options, and I'd rather not define another properties file just to store ${CATALINA_HOME}/logs/logs.txt. Is there any way I can do it programatically? What are the other options? No. It would be against the spirit, if not the letter, or the servlet specification for a servlet to be able to find out such details about its container. Even the approaches I showed before weren't that portable. This is like those perennial how can I find out what port the server is running on in my servlet's init() method? (You can't with certainty/portability). Other options include adding a JNDI entry for your log file path into tomcat's server.xml and then doing a JNDI lookup in your servlet's init method, or mangling your log4j configuration together with tomcat's commons-logging configuration. The latter is just cruising for a bruising, and the former is too container-specific (requires modifying server.xml) for my preferences, so I didn't include them before. Typically the Ant option is the one I like best, but I guess you don't use Any to deploy/package your application? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Separate configs for different webapps
Ahhh, different class paths! Thanks. Pat -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List Subject: RE: Separate configs for different webapps Howdy, Yes. Instead of them sharing log4j.jar, put a copy of the jar in each app's WEB-INF/lib folder. Then keep the separate config files as you've done, in each app's WEB-INF/classes folder. Make sure there's no log4j.jar in tomcat's common/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:37 PM To: [EMAIL PROTECTED] Subject: Separate configs for different webapps Hi, I am probably asking a stupid question here because I am new to log4j and tomcat. I have two webapps running under tomcat (single JVM) that are sharing common libraries. I am trying to find a way to set up the logging properties such that the two webapps have different settings (i.e., different appenders, layouts, levels, etc.). I've tried putting a log4j.properties file in the classes directory for each of my webapps, but it seems it only automatically picks up the one associated with whichever webapp is started first by tomcat (the other one is never loaded). If I put an explicit call in both webapps to the PropertyConfigurator, it seems that whichever one loads last overwrites the previous settings. Can I get different settings for each of my webapps somehow? Pat Grever Software Development Engineer iIPS Connectivity - Management Applications Lab Phone: 208.396.2522 Fax: 208.396.4796 [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie how to place logfile under tomcat logs
Hi, this may be more a tomcat question so appologies if it is off-topic. I want to plcae the log file under %TOMCAT_HOME%\logs (where all the tomcat logs go). I have defined in web.xml: servlet servlet-nameMyServlet/servlet-name servlet-classfoo.bar.MyServlet/servlet-class init-param param-namelogfile/param-name param-valuelogs.txt/param-value /init-param /servlet and in the servlet: String logFile = getInitParameter(logfile); appender = new FileAppender(layout, logFile); How can I change this to put the log file under tomcat\logs without hard coding the path? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: discreet logging types - revisited
Yoav, Yes, these are both ideas that I've been looking at. If I change Logger (either wrap or create a new one), then I will probably use a separate repository to avoid the problems that Ceki discusses in his book. As for Filters, the problem there is that Filters are attached to Appenders, not to Loggers. In my first post two weeks ago, Paul responded with the same suggestion, but since the permitted types will vary by each logger, I would have to either build a parallel hierarchy to hold the types for each logger, or define appenders for each logger that I wanted to change the permitted types (and that could get rather ugly). I understand how to use MDC to tag the LogEvent with the type, but then I need to see if that logger should allow that type, that needs to be stored either with the logger, or in yet another global collection keyed by logger. And again, I'm not trying to say that levels are bad, it just that they are only one way of determining what should get logged. Thanks for the suggestions! --- regards --- Larry At 03:07 PM 8/14/03 -0400, you wrote: Howdy, I'm a fan of the Level system and its relationship, so no I'm not interested in your suggested mods, but I wanted to throw out an idea or two for you that might reduce the need for coding: - Can you use separate logger repositories as your types ? - Can you use a Filter attached to the root logger that matches based on type as an MDC attribute of the logging event? Yoav Shapira Millennium ChemInformatics -Original Message- From: Larry Young [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 3:10 PM To: [EMAIL PROTECTED] Subject: discreet logging types - revisited Hi all, Well, I'm still looking at how to use discreet logging types instead of the Level to control what messages are enabled. The difficulty resides in the need to enable/disable certain log types by package/class name. BTW, I posted my original message on 7/30/03 if you are interested. Basically, the way I've always built logging systems is by defining a set of discreet types to be used by the developers, and then allowed those types to be enabled/disabled individually. Unfortunately the level concept is fairly hard-wired into log4j. I say unfortunately not because levels are bad, but because there is no way to expand or get-around them with an alternate approach. Actually, levels can be viewed as a set of discreet types with an implicit ordering/relationship between them, but in log4j, there is no way to control the relationship test. Before I go on too much (which I do!), is there anyone else who is interested in discussing the idea of replacing the level with discreet types in the log4j package?? Basically I'm at a point where I need to make some decisions regarding how to proceed. If other members are interested in pursuing this idea, then I'll explore the idea of modifying the Logger classes (et. al.) to replace the level with types, with the intention of folding those changes back into the product. But if no one is interested, I'll just make some small mods to Logger for my own purposes and handle it as a one-off type situation. In either case, I intend to move forward with log4j! It has many features which I'm planning to use in the future (like that IMAppender being discussed!!). Mostly its a matter of whether I do a complete implementation to replace levels, or just a quick fix to solve my problems. Thoughts, comments ??? Ceki, as one of the main champions for log4j, do you have any input? --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: New issue on Log4J initialization
Jake, Before I go on I want to thank you for all your help and patience. I decided to test something out and totally removed my application and all instances of our log4j-1.2.8 jar file. Guess what happens? I still get the error: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. What are your thoughts about this? Thanks again. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 10:45 AM To: Log4J Users List At 09:25 AM 8/11/2003 -0400, you wrote: Jake, Having done as you said I am now getting a log file generated Glad you got things going. What do you think was the difference? Can you pinpoint the one change that made things start working? It would be good to know for future users having the same or similar problems. , although I still get the original error message from Tomcat: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. Any way to get that message to stop displaying? Did you put a copy of log4j.jar back into common/lib? That error is coming from commons-logging finding Log4j and using it in preference to j2sdk1.4.x logging, but if Log4j doesn't, then, find its configuration, you will get that error. Note that commons-logging does a bunch of classloading trickery to find and load external logging packages. It is entirely possible that it might be using the context class loader to find Log4j, thus being able to bypass the normal Java2 classloader hierarchy (where only classloader higher in the hierarchy are visible). However, I just tested having log4j.jar in my WEB-INF/lib and not in common/lib and commons-logging in common/lib couldn't see it (and, therefore, didn't get the Log4j error), so it is most likely that you have log4j.jar in common/lib (or shared/lib) or some other place where commons-logging in Tomcat can see log4j.jar. Remove Log4j.jar and you won't see that erroror, I suppose, you could add log4j.xml or log4j.properties to common/classes and all would be well. Jake -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 2:05 AM To: Log4J Users List Hi Timothy, This is why, when possible, I install apps manually by simply unzipping them to a directory rather than running some fancy install which I have no control over. I do this with Tomcat. I suppose this isn't possible with current versions of Websphere, but they really shouldn't be modifying your classpath anyway. I'd send them a complaint about this so that they stop this practice in the future. Their batch scripts should set everything up dynamically rather than modify the system CLASSPATH variable. Anyway, you can achieve this yourself by opening a command prompt and doing: set CLASSPATH . Now run Tomcat from there (although the default scripts should ignore the classpath anyway, now that I think about it). Anyway, try that out. If that doesn't help, maybe if you have a sample application you can send to me, I can test it out myself to see if I get logging or not. Some source code would also be good so I know where to expect logging statements to come from. Jake At 01:27 PM 8/8/2003 -0400, you wrote: Keith, The problem I have with removing all that stuff is that 90% of it was put there by applications. Should I remove parts of it anyway? I guess that's where my confusion is since (as I said) most of these variables were entered by the installation of the applications themselves. Thanks for your thoughts Keith! -Original Message- From: Keith Hatton [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:18 PM To: Log4J Users List single period = . = class files etc. based on this directory only. It's just that the CLASSPATH environment variable often does more harm than good. If you use java -cp something then the CLASSPATH is ignored, and often scripts that start Java apps will do just that. But then again, sometimes they add your CLASSPATH to theirs. That's when the trouble starts ... So basically, Jake's advice is, remove your CLASSPATH environment variable if at all possible. Certainly that sounds like way too much junk in there. Hope this helps Keith -Original Message- From: Farrell, Timothy [mailto:[EMAIL PROTECTED] Sent: 08 August 2003 17:00 To: Log4J Users List Subject: RE: New issue on Log4J initialization Can you (or someone)explain your first statement (I'd change your classpath to be no more than a single period)? I have both installed on my machine however, I only run one at a time depending on what I am working on. My app does not use struts or anything else requiring commons-logging. Jake, Enjoy your vacation! And thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL
RE: Creating log files relative to the web applications root directory?
Howdy, I suppose Adrian could be a woman's name as well, so you're right ;) AmendedVersion But if you're the server admin, you're king (or queen) ;) /AmendedVersion Yoav Shapira Millennium ChemInformatics -Original Message- From: Caroline Wood [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:13 AM To: 'Log4J Users List' Subject: RE: Creating log files relative to the web applications root directory? or Queen! lol ;) -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 11 August 2003 14:05 To: Log4J Users List; [EMAIL PROTECTED] Subject: RE: Creating log files relative to the web applications root directory? Howdy, What I've seen done to achieve this is have my ant deployment script fill the value when copying log4j.xml over. So in log4j.xml, you'd have param name=File value=@logFilePath@ / And in your ant script, you set filtering=true when copying log4j.xml, and replac the logFilePath token with the actual (absolute) path. As an aside, note that the servlet container is not required to give you write access under your webapp's root. In fact, many server admins dislike this, as they prefer a centralized log location for their systems. But if you're the server admin, you're king ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Adrian Beech [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 6:42 AM To: 'Log4J Users List' Subject: Creating log files relative to the web applications root directory? G'day, Is it possible to specify a log filename in the XML log4j properties file so that it is relative to the web applications root directory? I have the following in a log4j.xml file located in web-inf/classes with the log4j jar in the web-inf/lib directory. Logging seems to be fine except the rascal.log file is being created in the Tomcat application directory under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory tree. I'd prefer to have the log files in something like ../webapps/application/logs/logfilename. Is this possible? BTW, took a while to find the rascal.log file!!! --[log4j.xml]- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=rf class=org.apache.log4j.RollingFileAppender param name=file value=rascal.log/ param name=maxBackupIndex value=2/ param name=maxFileSize value=250KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{dd/MM/ HH:mm:ss} %-5p (%t) %l - %m%n/ /layout /appender root priority value=debug / appender-ref ref=rf/ /root /log4j:configuration --[End Of File]--- I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and Tomcat 4.1.24 on a Unix box as the production platform. AB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ _ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ___ _ This is an email from The CPP Group, Holgate Park, York, YO26 4GA; telephone 01904 544500. This message may contain information that is confidential. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify the sender immediately by email, facsimile or telephone and either return or destroy the original message. The CPP Group accept no responsibility for any changes made to this message after it has been sent by the original author. ___ _ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com
Separate configs for different webapps
Hi, I am probably asking a stupid question here because I am new to log4j and tomcat. I have two webapps running under tomcat (single JVM) that are sharing common libraries. I am trying to find a way to set up the logging properties such that the two webapps have different settings (i.e., different appenders, layouts, levels, etc.). I've tried putting a log4j.properties file in the classes directory for each of my webapps, but it seems it only automatically picks up the one associated with whichever webapp is started first by tomcat (the other one is never loaded). If I put an explicit call in both webapps to the PropertyConfigurator, it seems that whichever one loads last overwrites the previous settings. Can I get different settings for each of my webapps somehow? Pat Grever Software Development Engineer iIPS Connectivity - Management Applications Lab Phone: 208.396.2522 Fax: 208.396.4796 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JMSAppender with JBoss
I'm having no luck deploying a JMSAppender class (based on Jamie Tsao's code) under JBoss (3.0.7 and 3.2.1)... JBoss initializes log4j before it sets up the JMS queues, so my appender throws an exception trying to initialize. There appears to be no way to defer the initialization until such time as the queue is available, and no way to retry the initialization. Calling the initialize (the activateOptions() method) from my servlet has no effect - I suspect a classloader problem here, i.e., my servlet and log4j are not using the same classloader. Doing all the work (creating the appender, configuring it, and attaching it to the root logger) in the servlet rather than via log4j.xml similarly has no effect -- the appender's append() method is never called. Help? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
configuration error
I am seeing this in the catalina.out and not sure why. I have moved an application using log4j-1.2.4 from unix to windows and recieved this error message. Any suggestions? thanks Scott log4j: Parsing appender named WR1. log4j:ERROR A org.apache.log4j.RollingFileAppender object is not assignable to a org.apache.log4j.Appender variable. log4j.debug=true log4j.logger.com.workflow.bflow=DEBUG, WR1 log4j.additivity.com.workflow.bflow=false log4j.appender.WR1=org.apache.log4j.RollingFileAppender log4j.appender.WR1.File=C:/logs/wrapper.log log4j.appender.WR1.layout=org.apache.log4j.PatternLayout log4j.appender.WR1.layout.ConversionPattern=%d{DATE} [%p] %c{1}.%M - %m%n log4j.appender.WR1.MaxFileSize=5000KB log4j.appender.WR1.MaxBackupIndex=30 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RollingFileAppender not backing up file
I have a RollingFileAppender set up, but it is not backing up after maxfilesize of 50kb Here is my properties file ** #log4j.rootCategory=DEBUG,dest1,A1 log4j.appender.rootLogger.Append=true Second appender writes to a file log4j.category.nfcs=info, dest1 log4j.debug=true log4j.appender.dest1=org.apache.log4j.RollingFileAppender nfcsfilename=c:/apps/ipt/log/nfcs/nfcs1.log log4j.appender.dest1.File=${nfcsfilename} log4j.appender.dest1.Append=true # Control the maximum log file size log4j.appender.dest1.MaxFileSize=50KB # Archive log files (one backup file here) log4j.appender.dest1.MaxBackupIndex=3 log4j.appender.dest1.layout=org.apache.log4j.PatternLayout log4j.appender.dest1.layout.ConversionPattern=%-5p (%t) %l %c %d %M(%F:%L). %x: %m%n * Here is the code where I do the settings at the start of my program. PropertyConfigurator p1 = new PropertyConfigurator(); p1.configureAndWatch(logPath+log4j.properties, 5000); l = ((RollingFileAppender) (cat.getLogger(nfcs)) .getAppender(dest1)); System.out.println(Value of append:+ l.getAppend()); l.setAppend(true); PropertySetter ps = new PropertySetter(l); ps.setProperty(File, logfile); ps.setProperty(Append,true); PrintWriter k = new PrintWriter(System.out); PropertyPrinter p = new PropertyPrinter(k); p.print(k); l.rollOver(); l.activateOptions(); ** For some reason when the log4j system reads it it sets the file append property back to false And overwrites the existing file [8/14/03 11:13:04:413 CDT] 4e65babb SystemOut O log4j: setFile called: c:/apps/ipt/log/nfcs/nfcs1.log, false ( --this should be true) But how can I control that. Even in the write method I do this public static void writeInfoLog(String s) { try { if (!l.getAppend()) { l.setAppend(true); l.activateOptions(); } if (cat.isInfoEnabled()) { cat.info(s); //cat.log(WRAPPER_FQN, Priority.INFO, s, null); } } catch (Exception e) { cat.error(In writeLog: + e.getMessage()); } } But the getAppend check was futile. Any suggestions? Thanks Manoj Mathew [8/14/03 11:11:30:661 CDT] 6742bab3 SystemOut O log4j: Parsing for [nfcs] with value=[info, dest1]. [8/14/03 11:11:30:661 CDT] 6742bab3 SystemOut O log4j: Level token is [info]. [8/14/03 11:11:30:661 CDT] 6742bab3 SystemOut O log4j: Category nfcs set to INFO [8/14/03 11:11:30:661 CDT] 6742bab3 SystemOut O log4j: Parsing appender named dest1. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Parsing layout options for dest1. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Setting property [conversionPattern] to [%-5p (%t) %l %c %d %M(%F:%L). %x: %m%n]. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: End of parsing for dest1. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Setting property [file] to [c:/apps/ipt/log/nfcs/nfcs1.log]. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Setting property [maxFileSize] to [50KB]. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Setting property [maxBackupIndex] to [3]. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Setting property [append] to [true]. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: setFile called: c:/apps/ipt/log/nfcs/nfcs1.log, true [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: setFile ended [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Parsed dest1 options. [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Handling log4j.additivity.nfcs=[null] [8/14/03 11:11:30:677 CDT] 6742bab3 SystemOut O log4j: Finished configuring. [8/14/03 11:11:31:505 CDT] a75ba9f SystemOut O log4j: Could not find root logger information. Is this OK? [8/14/03 11:11:31:505 CDT] a75ba9f SystemOut O log4j: Parsing for [nfcs] with value=[info, dest1]. [8/14/03 11:11:31:505 CDT] a75ba9f SystemOut O log4j: Level token is [info]. [8/14/03 11:11:31:505 CDT] a75ba9f SystemOut O log4j: Category nfcs set to INFO [8/14/03 11:11:31:505 CDT] a75ba9f SystemOut O log4j: Parsing appender named dest1. [8/14/03 11:11:31:521 CDT] a75ba9f SystemOut O log4j: Parsing layout
JMSAppender initialization
(I'm a new subscriber, not sure if this request was posted on the first attempt...) I'm having no luck deploying a JMSAppender class (based on Jamie Tsao's code) under JBoss (3.0.7 and 3.2.1)... JBoss initializes log4j before it sets up the JMS queues, so my appender throws an exception trying to initialize. There appears to be no way to defer the initialization until such time as the queue is available, and no way to retry the initialization. Calling the initialize (the activateOptions() method) from my servlet has no effect - I suspect a classloader problem here, i.e., my servlet and log4j are not using the same classloader. Doing all the work (creating the appender, configuring it, and attaching it to the root logger) in the servlet rather than via log4j.xml similarly has no effect -- the appender's append() method is never called. Any assistance would be appreciated, thanks. Don Isenor ePocket Inc. [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how do i get Log4j in Tomcat environment?
Jake, Thanks for your thoughts. I do have the log4j.jar file in the CATALINA_HOME/common/lib and the WEB-INF/classes as well. I am not getting any logging either. The application is supposed to write to a file and does not. The problem appears to be that log4j is not starting due to the before mentioned error (i.e. the appender missing). I also have the application writing to the console just so that I can see if log4j is initializing upon startup. Let me know if you have any additional thoughts. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 11:38 AM To: Log4J Users List I see that error in Tomcat5 as well. I assume you have log4j.jar in CATALINA_HOME/common/lib? Did you also add log4j.jar to WEB-INF/lib of your application? If not, do that and make sure your log4j.xml is in WEB-INF/classes. Everything should work fine for you. The error is inconsequential. When commns-logging (which Tomcat uses) finds log4j.jar, it uses it but there seems to be something wrong with the way they are configuring it. It shouldn't affect your application in the least. Just ignore the message. Having log4j.jar in WEB-INF/lib gives you a completely separate logging environment than that of the server. BTW, are you not getting any logging from your application? You should be if you have things configured correctly as I've described above. Jake At 09:57 AM 8/7/2003 -0400, you wrote: I am getting a startup error now on Log4J that is hopefully leading me to a solution. The error is: Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I am currently running Tomcat 4.1.27 on XP-Pro. I checked the log4j.xml file and it includes the necessary appenders. Does anyone know what may be causing this error. Thanks. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 2:58 PM To: Log4J Users List What exactly is the current problem you are having? Just add log4j.jar to WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you are ready to go. There are a couple of other options that are more advanced, but this should get you going for now. Jake At 06:39 PM 8/6/2003 +0100, you wrote: Hi, Trying to use log4j in Tomcat environment. Seen loads of messages on this but haven't got Much useful stuff from them. Could someone direct me to an appropriate resource. Thanks KB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Location of log files
Hello I could not find a simple solution to this problem. I deploy a web application (a War file) in a web server (iplanet) and an ejb application ( an ear file) in OAS (oracle application server). I want to use log4j in both applications. The logging works fine. The problem is specifying the location of the log file. I use log4j.xml to configure log4j. In there I have to specify the location of the log file as absolute path. This creates a problem because we have to edit log4j.xml during each deployment of our application to edit the location of the log file. I attempted to solve the problem by adding the following code in a utility class rootLogger = Logger.getRootLogger(); FileAppender fp = (FileAppender) rootLogger.getAppender(LOGFILE); String fileName = fp.getFile(); String dir = getOracleRootDir(); if (dir!=null) { StringBuffer logFilePath = new StringBuffer(dir); logFilePath.append(File.separator+log+File.separator+fileName); fp.setFile(logFilePath.toString()); fp.activateOptions(); } which is kind of clumsy. Is there any way of specifying the location of the log file without editing log4j.xml (e.g. programmatically or otherwise) Regards, Grum - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sometimes see log4j:ERROR Failed to flush writer,
Hi, I am using 1.4.2.8. I see the following error sometimes when trying to log messages. I am not able to pin point when this happens. Any pointers as to why this is happning ? Thanks, ~preetham java.io.InterruptedIOException: Interrupted system call at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:212) at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:223) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:237) at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:49) at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:306) at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java: 225) at org.apache.log4j.WriterAppender.append(WriterAppender.java:150) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(Ap penderAttachableImpl.java:57) at org.apache.log4j.Category.callAppenders(Category.java:187) at org.apache.log4j.Category.forcedLog(Category.java:372) at org.apache.log4j.Category.log(Category.java:864) : : : - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie how to place logfile under tomcat logs
I'm not having much luck with this, as you suggested I changed from input stream to URL, but i've tried everything and it doesn't want to pick up the file. This is what I have: URL url = this.getClass().getResource(com/foo/bar/message.properties); PropertyConfigurator.configure(url); -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 4:23 PM To: Log4J Users List Subject: RE: Newbie how to place logfile under tomcat logs Howdy, yeah, I'm using ant but I dont like the fact that it is hard-coded. It's not hard-coded, certainly not more hard-coded than a properties file. I think I'll use the properties file option, we have a properties file already I'll just add the log4j properties to that. I don't suppose you know how to load the properites file when it is in a JAR? because it says If the file is in a jar, use Class#getResource to get the URL to it. Don't use the File/IO approach. Then use PropertyConfigurator.configure(URL configURL) instead of configure(Properties p). You can also consider putting the properties file outside a jar, i.e. under WEB-INF, and using the ServletContext#getResource approach instead of Class#getResource. This way you can easily modify the properties file without having to repackage your jar. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j: dump wrap-around buffer of all log messages
Hi, I don't see your point. If you put the logged messages to a circular buffer that holds say 16k messages at a time, then you won't have high memory usage just 16k*size of a logged message. Of course if your code if full of debug logging, then the program will be slow, but on the other hand will give you very valuable feedback in case of an exception/error. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 3:29 PM To: Log4J Users List Subject: RE: log4j: dump wrap-around buffer of all log messages Howdy, I would really want this sort of feature benchmarked for memory use ;) Perhaps this is one of the reasons log4j has better performance than your current java trace kit ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Glc [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:24 AM To: Log4J Users List Subject: Re: log4j: dump wrap-around buffer of all log messages Yes, this is certainly possible. The SMTPAppender works in a similar fashion. At 03:09 PM 8/11/2003 +0200, you wrote: Dear log4j users, Currently I'm evaluating log4j 1.2.8 to replace an other Java Trace package (see http://visibleworkings.com/trace/) in our applications. Log4j's big advantage is its performance, but still I'm missing a feature that is present in the Java Trace package: the ability to dump a wrap-around buffer of, let's say, the last 500 log messages in the log file. The wrap-around buffer (think of it as an array of let's say 500 log messages) contains at any moment, the last 500 log messages. The idea is that the logger has 2 log levels: one which determines what level is present in the log file (or std out or whatever), another which determines at what level the internal wrap-around buffer is filled with messages. This way, it is possible to let your application log at level INFO, while the internal buffer keeps all messages of level DEBUG or higher. When an exception is thrown, the user should have the ability to request a dump of the buffer, such that the more detailed DEBUG messages are also present in the log file to make debugging more easy. Is this possible in log4j? If not, has anyone a workaround for this or should I ask for a feature request? Kind regards, Patrick Hancke Siemens Atea IC D BS PD2 tel ++32(0)14 - 25 24 27 fax ++32(0)14 - 25 30 25 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: calling DOMConfigurator.configureAndWatch() 2 times
Howdy, What should happen if the configureAndWatch() function is called twice? Are the previous settings erased? Are they accumulated ? It wouldn't be that hard to simply test this and see what happens ;) But looking at the code, you see: - configureAndWatch always creates a new XMLWatchdog, so you will have two XMLWatchdogs watching over the file. - Each XMLWatchdog would call DOMConfigurator#doConfigure(filename, repository) when the file changes, so this method will get called twice. So this is extra overhead that should be avoided if possible. - The configuration file will get parsed again with a new parser - Parsing will replace where found and add where not found. So if there's already a logger for class, for example, it will be retrieved if it exists and reconfigured, or a new one will be created if one doesn't exist. You can walk through the rest of DOMConfigurator if you feel like it ;) This is one issue where the test is easy so I wouldn't even spend time looking at the code ;) Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: discreet log types
If it can run, it can also walk! I think the existing system can be made to closely simulate the behavior you describe. Here is how: - Set the root logger to the level OFF. - Name your loggers as fatal, error, timing, CodeBlock, ControlPoint, DBAccess, Info, etc. Set their levels to OFF when you create them. - Whenever you can any of the above loggers, call it with the same printing metdod, say info(Object message) of the org.apache.log4j.Logger class. To enable a type set its level to INFO or above. To disable it, set its level to DEBUG or lower. Assuming the type names do not contain dot ('.') characters, the types will be independent. Do I need to continue? At 04:25 PM 7/30/2003 -0700, Larry Young wrote: Hello, I'm looking at creating a logging package for our applications (web non-web). The reason for yet-another-logger is that I want discreet logging types, not hierarchical levels. I've built this kind of a package before for previous projects, and ended up building the whole thing because I didn't think log4j could do what I wanted (that was several years ago). Now I'm building another one, and looking at the current version of log4j, and having read much of Ceki's book (which I highly recommend!), I'm thinking that there's got to be a way of re-configuring (bending?) log4j to do what I need. I don't think it's that far off. Basically, I want to be able to enable/disable logging for a particular class or package by type, and each type is totally independent of every other type. Some examples of types might be: Fatal, Error, Timing, CodeBlock, ControlPoint, DBAccess, Info, etc. There is no implicit ordering between these various types, so levels are inappropriate. What I want to be able to do is to turn on/off each type independently, so that I can turn on Timing without having to also turn on Info, or be able to turn on CodeBlock without turning on Error. I also want the users of my package to be able to define additional types and register them with the logger at runtime (via code or xml ???). Oh yeah, I also need to have the logger reload the config file (or some portion of it) on a regular basis so that we can change the enabled types without bouncing the app-server or restarting the application. I was thinking if I tried to tie all my types to a single level, and did something with the log-level filtering to enable/disable by package or class, that would get me close. I'm not sure how I'd tie in the type. I'd probably have to programatically update the log-level filters with updates to handle config changes at runtime. Thoughts, ideas, concerns???Any comments are gratefully accepted! :) --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie how to place logfile under tomcat logs
Thanks, thats a help but because of the setup of our application, I cant use the first two options, and I'd rather not define another properties file just to store ${CATALINA_HOME}/logs/logs.txt. Is there any way I can do it programatically? What are the other options? I have searched at the tomcat-user-list archives, and I have even googled for log4j tomcat logs but without much luck. any help would be appreciated -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 1:45 PM To: Log4J Users List Subject: RE: Newbie how to place logfile under tomcat logs Howdy, this may be more a tomcat question so appologies if it is off-topic. I want to plcae the log file under %TOMCAT_HOME%\logs (where all the tomcat logs go). Reading the archives of this list or the tomcat-user list would've revealed answers, as this is a fairly common question. I have defined in web.xml: servlet servlet-nameMyServlet/servlet-name servlet-classfoo.bar.MyServlet/servlet-class init-param param-namelogfile/param-name param-valuelogs.txt/param-value /init-param /servlet and in the servlet: String logFile = getInitParameter(logfile); appender = new FileAppender(layout, logFile); You have a number of options, including: - Setting param-value in web.xml to be an ant token, e.g. param-value@logFilePath@/param-value and have Ant fill in this token from whatever properly you want, e.g. $CATALINA_HOME/logs/logs.txt, when it's deploying web.xml. - Adding -DCATALINA_HOME=$CATALINA_HOME to your JAVA_OPTS in $CATALINA_HOME/bin/catalina.sh so that you can get Catalina home via System.getProperty(), then do String logFile = System.getProperty(CATALINA_HOME) + /logs/ + getInitParameter(logFile); - Using a log4j configuration file, rather than programmatic configuration, and having something like log4j.myAppender=org.apache.log4j.FileAppender log4j.myAppneder.File=${CATALINA_HOME}/logs/logs.txt ... There are other options as well. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: reset/empty logs on start
Hi Tim, try to use the property log4j.appender.R.Append=false which will start writing a new log file when your application starts. Hope this helps you, Patrick Hancke -Original Message- From: Tim Davidson [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 14:11 To: [EMAIL PROTECTED] Subject: reset/empty logs on start Hi, I am using the fileAppender to append the log file. What I want to do is empty the log file when the (tomcat) application starts. i.e when I create the logger, I want to use an empty log file. Any suggestions on how can I do this? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reset/empty logs on start
Hi, I am using the fileAppender to append the log file. What I want to do is empty the log file when the (tomcat) application starts. i.e when I create the logger, I want to use an empty log file. Any suggestions on how can I do this? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: discreet log types
Ceki, That's an interesting way of looking at logger types! But how would that allow me to enable/disable log messages for a particular class? One of the features I need is the ability to specify that a particular class should display a particular type of log message (or possibly more than one). This would appear to only let me set the message type system wide. Did I miss something? --- regards --- Larry At 11:10 PM 8/14/03 +0200, you wrote: If it can run, it can also walk! I think the existing system can be made to closely simulate the behavior you describe. Here is how: - Set the root logger to the level OFF. - Name your loggers as fatal, error, timing, CodeBlock, ControlPoint, DBAccess, Info, etc. Set their levels to OFF when you create them. - Whenever you can any of the above loggers, call it with the same printing metdod, say info(Object message) of the org.apache.log4j.Logger class. To enable a type set its level to INFO or above. To disable it, set its level to DEBUG or lower. Assuming the type names do not contain dot ('.') characters, the types will be independent. Do I need to continue? At 04:25 PM 7/30/2003 -0700, Larry Young wrote: Hello, I'm looking at creating a logging package for our applications (web non-web). The reason for yet-another-logger is that I want discreet logging types, not hierarchical levels. I've built this kind of a package before for previous projects, and ended up building the whole thing because I didn't think log4j could do what I wanted (that was several years ago). Now I'm building another one, and looking at the current version of log4j, and having read much of Ceki's book (which I highly recommend!), I'm thinking that there's got to be a way of re-configuring (bending?) log4j to do what I need. I don't think it's that far off. Basically, I want to be able to enable/disable logging for a particular class or package by type, and each type is totally independent of every other type. Some examples of types might be: Fatal, Error, Timing, CodeBlock, ControlPoint, DBAccess, Info, etc. There is no implicit ordering between these various types, so levels are inappropriate. What I want to be able to do is to turn on/off each type independently, so that I can turn on Timing without having to also turn on Info, or be able to turn on CodeBlock without turning on Error. I also want the users of my package to be able to define additional types and register them with the logger at runtime (via code or xml ???). Oh yeah, I also need to have the logger reload the config file (or some portion of it) on a regular basis so that we can change the enabled types without bouncing the app-server or restarting the application. I was thinking if I tried to tie all my types to a single level, and did something with the log-level filtering to enable/disable by package or class, that would get me close. I'm not sure how I'd tie in the type. I'd probably have to programatically update the log-level filters with updates to handle config changes at runtime. Thoughts, ideas, concerns???Any comments are gratefully accepted! :) --- regards --- Larry -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: discreet log types
On Fri, 2003-08-15 at 07:49, Larry Young wrote: Ceki, That's an interesting way of looking at logger types! But how would that allow me to enable/disable log messages for a particular class? One of the features I need is the ability to specify that a particular class should display a particular type of log message (or possibly more than one). This would appear to only let me set the message type system wide. Did I miss something? No, you haven't missed anything, it would set the types system wide, and allow you to specify the level system wide, but if that was not granular enough, can't you specific a particular Filter for your appender? (i.e all classes logging to the DB logger, but you filter for a particular class). I'm sure you could write yourself a Filter sub-class very quickly and attach it to an Appender via the configuration. You could configure this Filter impl with some configuration as to what classes you want to see output. Hope that makes sense. cheers, Paul Smith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Instant Logging Article
Someone back in may posted a Jabber IMAppender to the log4j-dev list. Here's the archive: http://marc.theaimsgroup.com/?l=log4j-devm=105344479430998w=2 I actually toyed with it some at work, where we have an internal jabber server running. I had to modify it somewhat to allow comma delimited lists in the value for the IMAddress parameter (to send to multiple recipients), but other than that the donated source worked great. That IBM article is superb though. The architecture diagrams are particularly interesting, as it is something I don't think is currently on the log4j site. I am glad to see it has already made it to the log4j articles section of the site. -Scott Heaberlin -Original Message- From: Paul Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 5:54 PM To: Log4J Users List Subject: Re: Instant Logging Article I could really use something like this myself. Could we perhaps ask if the author might be in a position to be able to donate the source code into the sandbox? cheers, Paul On Thu, 2003-08-14 at 06:14, Ceki Gülcü wrote: I hadn't seen it before. Really well written and informative article. I have a weak spot for SMTPAppender. (If you are not using it, you should.) I am still not 100% convinced, but this article makes a good case of why IMAppender might be preferable to SMTPAppender under certain circumstances. Thanks for forwarding it. At 09:08 AM 8/13/2003 -0400, you wrote: Howdy, Even though I'm sure many have seen it, I wanted to send a link to this interesting article: http://www-106.ibm.com/developerworks/java/library/j-instlog/ The article has an overview of log4j and details on how to implement a remote instant messages (IM) appender. Yoav Shapira Millennium ChemInformatics - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
properties file
Hi, since moving over to using the properties file I've been having a few problems: when I define the location as: log4j.appender.myAppender.File=${CATALINA_HOME}\logs\crisp_logs.txt nothing seems to happen - no error log is created. When I define the location as: log4j.appender.myAppender.File=${CATALINA_HOME}/logs/crisp_logs.txt I get the following: log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: \logs\crisp_logs.txt (The system cannot find the path specified) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.init(FileOutputStream.java:174) at java.io.FileOutputStream.init(FileOutputStream.java:102) at org.apache.log4j.FileAppender.setFile(FileAppender.java:272) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151) any ideas? CATALINA_HOME has been defined. The rest of the properties file is: log4j.rootLogger=ALL, myAppender log4j.appender.myAppender=org.apache.log4j.FileAppender log4j.appender.myAppender.File=${CATALINA_HOME}\logs\crisp_logs.txt log4j.appender.myAppender.layout=org.apache.log4j.SimpleLayout BTW, after creating the logger, I add an info to the file to see if its working. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Creating log files relative to the web applications root directory?
Why not have the admins modify the container's startup scripting so that some token system property gets set, and then reference that in your log4j config using variable substitution. For example, in my weblogic startup script I add a system property -Dappname.log.dir=/some/dir to the java command starting weblogic. We have multiple apps running, so the appname part of appname.log.dir is specific to each app. Then in my log4j.xml file, I use: appender name=file1 class=org.apache.log4j.DailyRollingFileAppender param name=file value=${appname.log.dir}/app_log.txt/ ... Another issue we have is that most of the development work is done on a Windows based machine and the production servers are hosted on a flavor of Unix I use windows for development/local-testing and then deploy onto Solaris boxes for dev/staging/prod, so I have the same setup. Hardcoding C:/... will of course blow up on unix jvms, however, using /... will actually work on windows boxes. Windows jvms interpret this to mean root of the current volume, which typically is equivalent to the root of the C-drive. -Original Message- From: Adrian Beech [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 5:35 AM To: 'Log4J Users List' Subject: RE: Creating log files relative to the web applications root directory? G'day, U, so basically then it is not possible to define a directory path in the log4j.xml properties file so that log files are placed relative to the web apps root directory? Or for that matter relative to any known anchor point like the server root directory? A problem we have is that we deploy .war files by sending the package to the server gods who then drop it into the webapps directory. Alas we don't have the rights to deploy directly to the server environment and tools like ANT whilst are good at building a distributable archive they do not quite make the grade when resolving tokens in a dynamic style of deployment. Another issue we have is that most of the development work is done on a Windows based machine and the production servers are hosted on a flavor of Unix. Hard coding a directory path like C:\..\ may work when doing the dev work under Windows but just don't kind of cut it on a Unix file system when it comes time to deployment. BTW, the last time I looked me was male so I'll opt out for king! AB -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, 11 August 2003 11:14 PM To: Log4J Users List Subject: RE: Creating log files relative to the web applications root directory? Howdy, I suppose Adrian could be a woman's name as well, so you're right ;) AmendedVersion But if you're the server admin, you're king (or queen) ;) /AmendedVersion Yoav Shapira Millennium ChemInformatics -Original Message- From: Caroline Wood [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:13 AM To: 'Log4J Users List' Subject: RE: Creating log files relative to the web applications root directory? or Queen! lol ;) -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: 11 August 2003 14:05 To: Log4J Users List; [EMAIL PROTECTED] Subject: RE: Creating log files relative to the web applications root directory? Howdy, What I've seen done to achieve this is have my ant deployment script fill the value when copying log4j.xml over. So in log4j.xml, you'd have param name=File value=@logFilePath@ / And in your ant script, you set filtering=true when copying log4j.xml, and replac the logFilePath token with the actual (absolute) path. As an aside, note that the servlet container is not required to give you write access under your webapp's root. In fact, many server admins dislike this, as they prefer a centralized log location for their systems. But if you're the server admin, you're king ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Adrian Beech [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 6:42 AM To: 'Log4J Users List' Subject: Creating log files relative to the web applications root directory? G'day, Is it possible to specify a log filename in the XML log4j properties file so that it is relative to the web applications root directory? I have the following in a log4j.xml file located in web-inf/classes with the log4j jar in the web-inf/lib directory. Logging seems to be fine except the rascal.log file is being created in the Tomcat application directory under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory tree. I'd prefer to have the log files in something like ../webapps/application/logs/logfilename. Is this possible? BTW, took a while to find the rascal.log file!!! --[log4j.xml]- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=rf class=org.apache.log4j.RollingFileAppender param name=file
calling DOMConfigurator.configureAndWatch() 2 times
Hello all, What should happen if the configureAndWatch() function is called twice? Are the previous settings erased? Are they accumulated ? thank you, Rami A. NOTICE: This communication contains information which may be proprietary, privileged or confidential. If you are not the intended recipient (or authorized to receive for the intended recipient), or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, disclose or otherwise use the information. Also, please indicate to the sender that you have received this communication in error and delete the copy you received. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[ newbie ]
I have installed, hopefully, all the files/packages needed for log4j. I wrote the log4jInit servlet and it compiled without any problems. I did the set-up in the web.xml as mentioned in the source course doc. The one thing I am unsure of is what exactly the log4j.lcf file should contain. Kind Regards Schalk Neethling Volume4.Development.Multimedia.Branding emotionalize.conceptualize.visualize.realize Tel: +27125468436 Fax: +27125468436 email:[EMAIL PROTECTED] web: www.volume4.co.za
RE: calling DOMConfigurator.configureAndWatch() 2 times
Also, it is programmatically possible to check if Log4j has been configured previously, thus avoiding the problem (which may or may not help in this particular case). My development team creates components used throughout our enterprise, and if an application has configured Log4j, we want to avoid configuring it ourselves and instead piggy-back off their configuration. If not, then we of course need to configure Log4j independently. We always check first to see if Log4j has been configured, and if and only if it has not, do we actually configure it at run-time. The code to check if Log4j has been configured follows: public static boolean isConfigured() { java.util.Enumeration enum = Logger.getRoot().getAllAppenders(); if ((enum != null) (!(enum instanceof org.apache.log4j.helpers.NullEnumeration))) { return true; } else { java.util.Enumeration loggers = org.apache.log4j.LogManager.getCurrentLoggers() ; while (loggers.hasMoreElements()) { Logger c = (Logger) loggers.nextElement(); if (!(c.getAllAppenders() instanceof org.apache.log4j.helpers.NullEnumeration)) return true; } } return false; } -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 9:18 AM To: Log4J Users List Subject: RE: calling DOMConfigurator.configureAndWatch() 2 times Howdy, What should happen if the configureAndWatch() function is called twice? Are the previous settings erased? Are they accumulated ? It wouldn't be that hard to simply test this and see what happens ;) But looking at the code, you see: - configureAndWatch always creates a new XMLWatchdog, so you will have two XMLWatchdogs watching over the file. - Each XMLWatchdog would call DOMConfigurator#doConfigure(filename, repository) when the file changes, so this method will get called twice. So this is extra overhead that should be avoided if possible. - The configuration file will get parsed again with a new parser - Parsing will replace where found and add where not found. So if there's already a logger for class, for example, it will be retrieved if it exists and reconfigured, or a new one will be created if one doesn't exist. You can walk through the rest of DOMConfigurator if you feel like it ;) This is one issue where the test is easy so I wouldn't even spend time looking at the code ;) Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message and any included attachments are from Siemens Medical Solutions USA, Inc. and are intended only for the addressee(s). The information contained herein may include trade secrets or privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using such information is strictly prohibited and may be unlawful. If you received this message in error, or have reason to believe you are not authorized to receive it, please promptly delete this message and notify the sender by e-mail with a copy to [EMAIL PROTECTED] Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trying to put logs under ${CATALINA_HOME}/logs/
yeah, log4j.appender.myAppender.File=%CATALINA_HOME%/logs/my_log.txt doesnt work either! -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 4:55 PM To: Log4J Users List Subject: RE: Trying to put logs under ${CATALINA_HOME}/logs/ Howdy, log4j.appender.myAppender.File=c:/jakarta-tomcat-4.1.24/logs/my_log.txt but this doesn't: log4j.appender.myAppender.File=${CATALINA_HOME}/logs/my_log.txt Did you try $CATALINA_HOME (on unix) or for your case %CATALINA_HOME% since you're on NT? The syntax with the curly braces is for Ant. You're trying to access environment variables. it would appear that it completely ignores the ${CATALINA_HOME} variable, which I have checked is defined. can anyone suggest a reason for this? I tried it with ${catalina.base} which i saw somewhere but that doesnt work either. And it doesnt like ${file.separator} either. I'm running winNT. Same thing for file.separator, although I don't think that's always defined as it is in java. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: log4j: dump wrap-around buffer of all log messages
Howdy, I would really want this sort of feature benchmarked for memory use ;) Perhaps this is one of the reasons log4j has better performance than your current java trace kit ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 9:24 AM To: Log4J Users List Subject: Re: log4j: dump wrap-around buffer of all log messages Yes, this is certainly possible. The SMTPAppender works in a similar fashion. At 03:09 PM 8/11/2003 +0200, you wrote: Dear log4j users, Currently I'm evaluating log4j 1.2.8 to replace an other Java Trace package (see http://visibleworkings.com/trace/) in our applications. Log4j's big advantage is its performance, but still I'm missing a feature that is present in the Java Trace package: the ability to dump a wrap-around buffer of, let's say, the last 500 log messages in the log file. The wrap-around buffer (think of it as an array of let's say 500 log messages) contains at any moment, the last 500 log messages. The idea is that the logger has 2 log levels: one which determines what level is present in the log file (or std out or whatever), another which determines at what level the internal wrap-around buffer is filled with messages. This way, it is possible to let your application log at level INFO, while the internal buffer keeps all messages of level DEBUG or higher. When an exception is thrown, the user should have the ability to request a dump of the buffer, such that the more detailed DEBUG messages are also present in the log file to make debugging more easy. Is this possible in log4j? If not, has anyone a workaround for this or should I ask for a feature request? Kind regards, Patrick Hancke Siemens Atea IC D BS PD2 tel ++32(0)14 - 25 24 27 fax ++32(0)14 - 25 30 25 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki For log4j documentation consider The complete log4j manual ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LogManager-error?
Hi, I used to get the same version. In my case the problem was some sort of clash between different versions of classes. I had used some classes specific to JRUn server 4.0 (it was in the classpath) This had caused the issue. However when I put the log4j class first in the classpath and the rest following this jar, this error vanished. You can try putting the log4j.jar file first in your classpath Regards Vinodh [EMAIL PROTECTED] wrote: Hi I have created a wrapper to Logger and here follows some code from that wrapper class (ExceptionCategory): private Logger logger; . public ExceptionCategory(String arg1) { logger = logger.getLogger(arg1); } Unfortunatly I get a runtime-exception when the ExceptionCategory-constructor is run: Servlet Error: #40;class: org/apache/log4j/LogManager, method: lt;clinitgt; signature: #40;#41;V#41; Incompatible argument to method: java.lang.VerifyError: (class: org/apache/log4j/LogManager, method: clinit signature: ()V) Incompatible argument to method The LogManager-class is called from the Logger-class and this is probably the first time LogManager is run on the server (clinit = class init?). I have thought of a number of possible causes (classpath-issues, property-configuration-errors and so on) but I have not been able to pinpoint the error to one of those, neither do I find it reasonable because the error-message seems pinpoint the error to the LogManager-class itself! I am using log4j1.2.5 and I am pretty sure that there are no errors in LogManager (or Logger) in this version, so what am I missing? Btw: Is the error-message clear to everyone? Or is it approriate of me to ask for better error-messages? mvh Morten Simonsen- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
Re: discreet log types
Paul, Yes, I need to be able to specify which class may display which set of discreet types. For example, I might have com.* allowed to display ERROR, but then override that for com.xyz.MyClass to display only TIMING, com.abc.def.* to display METHOD_TRACE TIMING, and com.abc.dataaccess.* to display DB_ACCESS. I've been looking at the filter solution based on your original suggestion (thanks!). But if I'm not mistaken, Filters can only be applied to Appenders, not Loggers. So I would have to define multiple appenders, one for each logger that I have, or rather one for each logger I explicitly define in the config file. That would seem to be rather cumbersome. And using Ceki's solution, each logger is based on the type, so the filter would still apply to all classes, since there is no class information in the LogEvent class. I could solve that using MDC, but I am still missing the critical piece which ties a specific class/package to a list of allowed logging types. The trick it seems to me is that I need to define the permitted logging types per class/package in the config file, just the way logging levels are defined today, either in conjunction with or as a replacement for. Ultimately, if I want to be able to enable/disable logging types by a specific class/package (just like levels are), then I need to build that association somewhere. I can define it either in the log4j config file, or in a separate config file (obviously, the fewer config files, the better!). And that association needs to be maintained in memory at runtime either with the current logger sitting in the default repository, or in a new logger class in a separate repository, or in a totally separate global collection associating loggers to their allowed types. I am sorry if I'm not explaining myself very well. I have a pretty clear idea in my head, but perhaps I'm not communicating it very well. Thanks for all your input! I am still interested to hear if anyone on the list thinks that the idea of logging by discreet types is of interest and would be a useful feature for others out there besides myself. BTW, I'll be out tomorrow, so I won't be checking my email again until Monday. Have a good weekend! --- regards --- Larry At 07:52 AM 8/15/03 +1000, you wrote: On Fri, 2003-08-15 at 07:49, Larry Young wrote: Ceki, That's an interesting way of looking at logger types! But how would that allow me to enable/disable log messages for a particular class? One of the features I need is the ability to specify that a particular class should display a particular type of log message (or possibly more than one). This would appear to only let me set the message type system wide. Did I miss something? No, you haven't missed anything, it would set the types system wide, and allow you to specify the level system wide, but if that was not granular enough, can't you specific a particular Filter for your appender? (i.e all classes logging to the DB logger, but you filter for a particular class). I'm sure you could write yourself a Filter sub-class very quickly and attach it to an Appender via the configuration. You could configure this Filter impl with some configuration as to what classes you want to see output. Hope that makes sense. cheers, Paul Smith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Larry Young The Dalmatian Group www.dalmatian.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: picking up wrong properties file
I still don't know what the root cause is but creating an initialization servlet as described in http://jakarta.apache.org/log4j/docs/manual.html seems to help. Thanks to Ceki Gülcü for the docs. Guido Guido Casper wrote: Hi all, I have a 3rd-party servlet for which I don't have the source code but which I need to configure for logging via WEB-INF/classes/log4j.properties. However my changes (and all the log4j.properties) are not picked up (everything is logged on the console with a different layout pattern) and if I delete log4j.properties, log4j does not even complain. I copied the complete Tomcat installation (4.1.18 on Linux) to a different box and it works. I have no indication what is different. Same JDK (1.4.1_01), same CLASSPATH and everything else is the same. I know something must be different, I just can't find out what that is. I could write a small servlet filter, if there only is a way to tell where the webapp gets its log4j configuration from. Any idea is greatly appreciated. Thanks Guido - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie how to place logfile under tomcat logs
Howdy, this may be more a tomcat question so appologies if it is off-topic. I want to plcae the log file under %TOMCAT_HOME%\logs (where all the tomcat logs go). Reading the archives of this list or the tomcat-user list would've revealed answers, as this is a fairly common question. I have defined in web.xml: servlet servlet-nameMyServlet/servlet-name servlet-classfoo.bar.MyServlet/servlet-class init-param param-namelogfile/param-name param-valuelogs.txt/param-value /init-param /servlet and in the servlet: String logFile = getInitParameter(logfile); appender = new FileAppender(layout, logFile); You have a number of options, including: - Setting param-value in web.xml to be an ant token, e.g. param-value@logFilePath@/param-value and have Ant fill in this token from whatever properly you want, e.g. $CATALINA_HOME/logs/logs.txt, when it's deploying web.xml. - Adding -DCATALINA_HOME=$CATALINA_HOME to your JAVA_OPTS in $CATALINA_HOME/bin/catalina.sh so that you can get Catalina home via System.getProperty(), then do String logFile = System.getProperty(CATALINA_HOME) + /logs/ + getInitParameter(logFile); - Using a log4j configuration file, rather than programmatic configuration, and having something like log4j.myAppender=org.apache.log4j.FileAppender log4j.myAppneder.File=${CATALINA_HOME}/logs/logs.txt ... There are other options as well. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Creating log files relative to the web applications root directory?
G'day, Is it possible to specify a log filename in the XML log4j properties file so that it is relative to the web applications root directory? I have the following in a log4j.xml file located in web-inf/classes with the log4j jar in the web-inf/lib directory. Logging seems to be fine except the rascal.log file is being created in the Tomcat application directory under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory tree. I'd prefer to have the log files in something like ../webapps/application/logs/logfilename. Is this possible? BTW, took a while to find the rascal.log file!!! --[log4j.xml]- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=rf class=org.apache.log4j.RollingFileAppender param name=file value=rascal.log/ param name=maxBackupIndex value=2/ param name=maxFileSize value=250KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{dd/MM/ HH:mm:ss} %-5p (%t) %l - %m%n/ /layout /appender root priority value=debug / appender-ref ref=rf/ /root /log4j:configuration --[End Of File]--- I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and Tomcat 4.1.24 on a Unix box as the production platform. AB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: New issue on Log4J initialization
I am running 5.0.5 at the moment. I will implement your suggestion. Thanks again. I need to head out but will check in with you first thing tomorrow. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 3:49 PM To: Log4J Users List When you say version 5.0, do you literally mean version 5.0 or the latest version of the 5.0 series which is 5.0.7? I tested on 5.0.7 and don't get the message at all if log4j.jar is *not* in common/lib. I do get the message (but actually a slightly different one) if log4j.jar *is* in common/lib. However, I can fix this by adding the following log4j.xml file to common/classes ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=false threshold=debug appender name=A1 class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%-4r [%t] %-5p %c %x - %m%n/ /layout /appender root level value=info/ appender-ref ref=A1/ /root /log4j:configuration I suggest upgrading to Tomcat-5.0.7 if you haven't already and add the above log4j.xml to common/classes. Jake At 03:24 PM 8/11/2003 -0400, you wrote: Yes it is a clean install (version 5.0). I decided that since I could get logging to work with v4.1.27 that I would re-try v5.0 again. One thing that I noticed was that there was log4j path information in my classpath, so I took that out. I rebooted the machine and tried to start Tomcat again. I got the same appender messages. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 2:49 PM To: Log4J Users List What version of Tomcat are you using? And is it a clean install? That is, a stock install with nothing else added to it. Jake At 02:10 PM 8/11/2003 -0400, you wrote: Jake, Before I go on I want to thank you for all your help and patience. I decided to test something out and totally removed my application and all instances of our log4j-1.2.8 jar file. Guess what happens? I still get the error: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. What are your thoughts about this? Thanks again. Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 10:45 AM To: Log4J Users List At 09:25 AM 8/11/2003 -0400, you wrote: Jake, Having done as you said I am now getting a log file generated Glad you got things going. What do you think was the difference? Can you pinpoint the one change that made things start working? It would be good to know for future users having the same or similar problems. , although I still get the original error message from Tomcat: Log4j: WARN No appenders could be found for logger org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. Any way to get that message to stop displaying? Did you put a copy of log4j.jar back into common/lib? That error is coming from commons-logging finding Log4j and using it in preference to j2sdk1.4.x logging, but if Log4j doesn't, then, find its configuration, you will get that error. Note that commons-logging does a bunch of classloading trickery to find and load external logging packages. It is entirely possible that it might be using the context class loader to find Log4j, thus being able to bypass the normal Java2 classloader hierarchy (where only classloader higher in the hierarchy are visible). However, I just tested having log4j.jar in my WEB-INF/lib and not in common/lib and commons-logging in common/lib couldn't see it (and, therefore, didn't get the Log4j error), so it is most likely that you have log4j.jar in common/lib (or shared/lib) or some other place where commons-logging in Tomcat can see log4j.jar. Remove Log4j.jar and you won't see that erroror, I suppose, you could add log4j.xml or log4j.properties to common/classes and all would be well. Jake -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 2:05 AM To: Log4J Users List Hi Timothy, This is why, when possible, I install apps manually by simply unzipping them to a directory rather than running some fancy install which I have no control over. I do this with Tomcat. I suppose this isn't possible with current versions of Websphere, but they really shouldn't be modifying your classpath anyway. I'd send them a complaint about this so that they stop this practice in the future. Their batch scripts should set everything up dynamically rather than modify the system CLASSPATH variable. Anyway, you can achieve this yourself by opening a command prompt and doing: set
RE: Creating log files relative to the web applications root directory?
Howdy, What I've seen done to achieve this is have my ant deployment script fill the value when copying log4j.xml over. So in log4j.xml, you'd have param name=File value=@logFilePath@ / And in your ant script, you set filtering=true when copying log4j.xml, and replac the logFilePath token with the actual (absolute) path. As an aside, note that the servlet container is not required to give you write access under your webapp's root. In fact, many server admins dislike this, as they prefer a centralized log location for their systems. But if you're the server admin, you're king ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Adrian Beech [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 6:42 AM To: 'Log4J Users List' Subject: Creating log files relative to the web applications root directory? G'day, Is it possible to specify a log filename in the XML log4j properties file so that it is relative to the web applications root directory? I have the following in a log4j.xml file located in web-inf/classes with the log4j jar in the web-inf/lib directory. Logging seems to be fine except the rascal.log file is being created in the Tomcat application directory under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory tree. I'd prefer to have the log files in something like ../webapps/application/logs/logfilename. Is this possible? BTW, took a while to find the rascal.log file!!! --[log4j.xml]- ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=rf class=org.apache.log4j.RollingFileAppender param name=file value=rascal.log/ param name=maxBackupIndex value=2/ param name=maxFileSize value=250KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{dd/MM/ HH:mm:ss} %-5p (%t) %l - %m%n/ /layout /appender root priority value=debug / appender-ref ref=rf/ /root /log4j:configuration --[End Of File]--- I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and Tomcat 4.1.24 on a Unix box as the production platform. AB - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using customized filters in JBoss3.0.6
Hello, We work with JBoss3.0.6. Have written some customized filters in my project and configured the log4j.xml to use them in the ConsoleAppender. JBoss complains for not recognizing the Filter class: java.lang.NoClassDefFoundError: org/apache/log4j/spi/Filter Without the filters definition in the log4j.xml it works fine. The actual log4j.jar that JBoss seems to use, does contain the required class. What am I missing ? thank you, Rami A. NOTICE: This communication contains information which may be proprietary, privileged or confidential. If you are not the intended recipient (or authorized to receive for the intended recipient), or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, disclose or otherwise use the information. Also, please indicate to the sender that you have received this communication in error and delete the copy you received. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: New issue on Log4J initialization
Hi Timothy, This is why, when possible, I install apps manually by simply unzipping them to a directory rather than running some fancy install which I have no control over. I do this with Tomcat. I suppose this isn't possible with current versions of Websphere, but they really shouldn't be modifying your classpath anyway. I'd send them a complaint about this so that they stop this practice in the future. Their batch scripts should set everything up dynamically rather than modify the system CLASSPATH variable. Anyway, you can achieve this yourself by opening a command prompt and doing: set CLASSPATH . Now run Tomcat from there (although the default scripts should ignore the classpath anyway, now that I think about it). Anyway, try that out. If that doesn't help, maybe if you have a sample application you can send to me, I can test it out myself to see if I get logging or not. Some source code would also be good so I know where to expect logging statements to come from. Jake At 01:27 PM 8/8/2003 -0400, you wrote: Keith, The problem I have with removing all that stuff is that 90% of it was put there by applications. Should I remove parts of it anyway? I guess that's where my confusion is since (as I said) most of these variables were entered by the installation of the applications themselves. Thanks for your thoughts Keith! -Original Message- From: Keith Hatton [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:18 PM To: Log4J Users List single period = . = class files etc. based on this directory only. It's just that the CLASSPATH environment variable often does more harm than good. If you use java -cp something then the CLASSPATH is ignored, and often scripts that start Java apps will do just that. But then again, sometimes they add your CLASSPATH to theirs. That's when the trouble starts ... So basically, Jake's advice is, remove your CLASSPATH environment variable if at all possible. Certainly that sounds like way too much junk in there. Hope this helps Keith -Original Message- From: Farrell, Timothy [mailto:[EMAIL PROTECTED] Sent: 08 August 2003 17:00 To: Log4J Users List Subject: RE: New issue on Log4J initialization Can you (or someone)explain your first statement (I'd change your classpath to be no more than a single period)? I have both installed on my machine however, I only run one at a time depending on what I am working on. My app does not use struts or anything else requiring commons-logging. Jake, Enjoy your vacation! And thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 11:49 AM To: Log4J Users List Yikes. I'd change your classpath to be no more than a single period. Set the classpath as needed in scripts. That way, you won't force libraries that aren't needed or collide with other libraries on every app you run. Just to be clear. Are you running Tomcat or Websphere? I can't tell you what the behavior in Websphere will be. Tomcat should definitely work for logging, though. BTW, what does your app consist of? Does it use Struts or anything else requiring commons-logging? That's the most evil invention to come out of the Apache project. In my experience, it just messes up everything. If this is an issue with commons-logging, you'll have to take it up with them. BTW, I will be leaving for a mini vacation shortly, so someone else is probably going to have to take the reins on this one if you require more help. good luck! Jake At 11:11 AM 8/8/2003 -0400, you wrote: Actually that is the message I am getting (I just abbreviated it a bit). In my application the log4j.jar file does not exist in the common/lib directory of Tomcat. This file only exists in the web-inf/lib directory of my application. Could this be attributed to my environmental settings: .;E:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\ldap.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jndi.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\fscontext.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar; E:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8;E:\istrobe20jars\dom4j.jar; E:\Tomcat 4.1\common\lib\servlet.jar; E:\Tomcat 4.1\bin\bootstrap.jar; E:\Sandbox\build\classes; C:\j2sdk1.4.1_01\bin; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\ant.jar; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\optional.jar Thanks for hanging in there. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List There doesn't appear to be anything wrong with your log4j.xml (except that you should use level rather than priority, but that isn't the issue here). Note that the
Re: discreet log types
Yes, actually I had already gone down that road as one of my first solutions before I posted my original message. However, when I considered that option, I was appending the logging type, which was a problem when trying to specify packages instead of individual classes. But your suggestion to put it at the beginning could solve that problem. As I was writing my last message I also started with it at the end, and realised the same thing you have. I think it has more power at the front. Log4j does not have a complete taxonomy, it is strictly hierarchical, so you will ALWAYS have to choose a primary node structure at the top (this is usually the package name hierarchy). It sounds like your aspect (DB, TRACE) etc is your primary concern, with a secondary concern of the source class. I'm not so worried about it being clumsy because I can always hide it with a wrapper around the front-end if necessary (i.e. create a static factory-like method). And I would only have to define loggers for the logging types that my class would be using, not necessarily every one that is defined, especially since the list needs to be extensible. And it would also allow me to enable multiple logging types for a single class/package. I'll have to give this one some more thought! It's not the cleanest of solutions, but if no one else on the list thinks this would be a good feature to have, then perhaps this would be the quickest solution for my situation. Thanks again for your ideas! Feel free to discuss your ideas further on the list as you develop them, I'm sure other people will be interested in how you go (definately me). May even be worth a nice Wiki page outlining your ideas, and how you accomplished them. I'm sure other people would appreciate it if you have the time. (see http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages) cheers, Paul Smith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Separate configs for different webapps
Follow on question... Some of my code is shared among several webapps. We've been installing the jar files in the tomcat shared/lib directory. I'd like the log messages from these shared components to use the same logging configuration as the specific webapp that is calling them is using. Essentially things running on a particular thread (and child threads it starts) would use the same log configuration. If I use the solution mentioned (i.e., putting the log4j.jar in the webapp's classes directory), it seems like this will only cause the classes associated with the webapp to use the logging configuration? In other words, won't log calls from the shared jars use a different logging configuration than the webapp methods that are calling them? If this is a problem, then is there a way around it? It seems like I want some type of logging context that I can establish on a thread that defines ALL of the log settings, not just a name. Pat -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List Subject: RE: Separate configs for different webapps Howdy, Yes. Instead of them sharing log4j.jar, put a copy of the jar in each app's WEB-INF/lib folder. Then keep the separate config files as you've done, in each app's WEB-INF/classes folder. Make sure there's no log4j.jar in tomcat's common/lib directory. Yoav Shapira Millennium ChemInformatics -Original Message- From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:37 PM To: [EMAIL PROTECTED] Subject: Separate configs for different webapps Hi, I am probably asking a stupid question here because I am new to log4j and tomcat. I have two webapps running under tomcat (single JVM) that are sharing common libraries. I am trying to find a way to set up the logging properties such that the two webapps have different settings (i.e., different appenders, layouts, levels, etc.). I've tried putting a log4j.properties file in the classes directory for each of my webapps, but it seems it only automatically picks up the one associated with whichever webapp is started first by tomcat (the other one is never loaded). If I put an explicit call in both webapps to the PropertyConfigurator, it seems that whichever one loads last overwrites the previous settings. Can I get different settings for each of my webapps somehow? Pat Grever Software Development Engineer iIPS Connectivity - Management Applications Lab Phone: 208.396.2522 Fax: 208.396.4796 [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: New issue on Log4J initialization
There doesn't appear to be anything wrong with your log4j.xml (except that you should use level rather than priority, but that isn't the issue here). Note that the error you've mentioned in previous emails is not an issue here... Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I'd bet that goes away if you remove log4j.jar from CATALINA_HOME/common/lib (please test this out). Having log4j.jar in WEB-INF/lib of your application provides for a separate logging environment since it is in a distinct classloader. I'm at a loss as to why you are not seeing debug message? You are running code that does logger.debug(), right? Anyone else have a clue what is happening here? Jake At 09:49 AM 8/8/2003 -0400, you wrote: Can anyone see anything wrong with this log4j.xml file? For some reason I cannot get lof4j to initialize and it's driving me crazy. I am sure it is something I am doing wrong but I can't seem to locate the problem. The error message I am getting is: No appenders could be found for logger. Please initialize the log4j system properly . Here is the log4j file: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd !-- For Ant build -- log4j:configuration !-- order of elements: renderer*, appender*, (category | ...) , root -- appender name=LF5 class=org.apache.log4j.lf5.LF5Appender param name=MaxNumberOfRecords value=1000/ /appender appender name=file class=org.apache.log4j.RollingFileAppender param name=file value=build.log/ param name=maxBackupIndex value=3/ param name=maxFileSize value=100KB/ layout class=org.apache.log4j.TTCCLayout/ /appender !-- if using this in ant, be sure the java mail libraries are avaiable -- appender name=mail class=org.apache.log4j.net.SMTPAppender param name=Threshold value=debug/ param name=SMTPHost value=bh1.compuware.com/ param name=bufferSize value=1/ param name=to value=[EMAIL PROTECTED]/ param name=from value=[EMAIL PROTECTED]/ param name=subject value=Ant test/ layout class=org.apache.log4j.HTMLLayout/ /appender appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%t] %C{2} (%F:%L) - %m%n/ /layout /appender root priority value=debug / appender-ref ref=STDOUT / appender-ref ref=file/ !-- appender-ref ref=mail/ -- !-- appender-ref ref=LF5/ -- /root /log4j:configuration Thank you for your help. The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: New issue on Log4J initialization
Actually that is the message I am getting (I just abbreviated it a bit). In my application the log4j.jar file does not exist in the common/lib directory of Tomcat. This file only exists in the web-inf/lib directory of my application. Could this be attributed to my environmental settings: .;E:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\ldap.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jndi.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\fscontext.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar; E:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8;E:\istrobe20jars\dom4j.jar; E:\Tomcat 4.1\common\lib\servlet.jar; E:\Tomcat 4.1\bin\bootstrap.jar; E:\Sandbox\build\classes; C:\j2sdk1.4.1_01\bin; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\ant.jar; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\optional.jar Thanks for hanging in there. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List There doesn't appear to be anything wrong with your log4j.xml (except that you should use level rather than priority, but that isn't the issue here). Note that the error you've mentioned in previous emails is not an issue here... Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I'd bet that goes away if you remove log4j.jar from CATALINA_HOME/common/lib (please test this out). Having log4j.jar in WEB-INF/lib of your application provides for a separate logging environment since it is in a distinct classloader. I'm at a loss as to why you are not seeing debug message? You are running code that does logger.debug(), right? Anyone else have a clue what is happening here? Jake At 09:49 AM 8/8/2003 -0400, you wrote: Can anyone see anything wrong with this log4j.xml file? For some reason I cannot get lof4j to initialize and it's driving me crazy. I am sure it is something I am doing wrong but I can't seem to locate the problem. The error message I am getting is: No appenders could be found for logger. Please initialize the log4j system properly . Here is the log4j file: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd !-- For Ant build -- log4j:configuration !-- order of elements: renderer*, appender*, (category | ...) , root -- appender name=LF5 class=org.apache.log4j.lf5.LF5Appender param name=MaxNumberOfRecords value=1000/ /appender appender name=file class=org.apache.log4j.RollingFileAppender param name=file value=build.log/ param name=maxBackupIndex value=3/ param name=maxFileSize value=100KB/ layout class=org.apache.log4j.TTCCLayout/ /appender !-- if using this in ant, be sure the java mail libraries are avaiable -- appender name=mail class=org.apache.log4j.net.SMTPAppender param name=Threshold value=debug/ param name=SMTPHost value=bh1.compuware.com/ param name=bufferSize value=1/ param name=to value=[EMAIL PROTECTED]/ param name=from value=[EMAIL PROTECTED]/ param name=subject value=Ant test/ layout class=org.apache.log4j.HTMLLayout/ /appender appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%t] %C{2} (%F:%L) - %m%n/ /layout /appender root priority value=debug / appender-ref ref=STDOUT / appender-ref ref=file/ !-- appender-ref ref=mail/ -- !-- appender-ref ref=LF5/ -- /root /log4j:configuration Thank you for your help. The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then
RE: New issue on Log4J initialization
single period = . = class files etc. based on this directory only. It's just that the CLASSPATH environment variable often does more harm than good. If you use java -cp something then the CLASSPATH is ignored, and often scripts that start Java apps will do just that. But then again, sometimes they add your CLASSPATH to theirs. That's when the trouble starts ... So basically, Jake's advice is, remove your CLASSPATH environment variable if at all possible. Certainly that sounds like way too much junk in there. Hope this helps Keith -Original Message- From: Farrell, Timothy [mailto:[EMAIL PROTECTED] Sent: 08 August 2003 17:00 To: Log4J Users List Subject: RE: New issue on Log4J initialization Can you (or someone)explain your first statement (I'd change your classpath to be no more than a single period)? I have both installed on my machine however, I only run one at a time depending on what I am working on. My app does not use struts or anything else requiring commons-logging. Jake, Enjoy your vacation! And thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 11:49 AM To: Log4J Users List Yikes. I'd change your classpath to be no more than a single period. Set the classpath as needed in scripts. That way, you won't force libraries that aren't needed or collide with other libraries on every app you run. Just to be clear. Are you running Tomcat or Websphere? I can't tell you what the behavior in Websphere will be. Tomcat should definitely work for logging, though. BTW, what does your app consist of? Does it use Struts or anything else requiring commons-logging? That's the most evil invention to come out of the Apache project. In my experience, it just messes up everything. If this is an issue with commons-logging, you'll have to take it up with them. BTW, I will be leaving for a mini vacation shortly, so someone else is probably going to have to take the reins on this one if you require more help. good luck! Jake At 11:11 AM 8/8/2003 -0400, you wrote: Actually that is the message I am getting (I just abbreviated it a bit). In my application the log4j.jar file does not exist in the common/lib directory of Tomcat. This file only exists in the web-inf/lib directory of my application. Could this be attributed to my environmental settings: .;E:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\ldap.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jndi.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\fscontext.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar; E:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8;E:\istrobe20jars\dom4j.jar; E:\Tomcat 4.1\common\lib\servlet.jar; E:\Tomcat 4.1\bin\bootstrap.jar; E:\Sandbox\build\classes; C:\j2sdk1.4.1_01\bin; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\ant.jar; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\optional.jar Thanks for hanging in there. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List There doesn't appear to be anything wrong with your log4j.xml (except that you should use level rather than priority, but that isn't the issue here). Note that the error you've mentioned in previous emails is not an issue here... Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I'd bet that goes away if you remove log4j.jar from CATALINA_HOME/common/lib (please test this out). Having log4j.jar in WEB-INF/lib of your application provides for a separate logging environment since it is in a distinct classloader. I'm at a loss as to why you are not seeing debug message? You are running code that does logger.debug(), right? Anyone else have a clue what is happening here? Jake At 09:49 AM 8/8/2003 -0400, you wrote: Can anyone see anything wrong with this log4j.xml file? For some reason I cannot get lof4j to initialize and it's driving me crazy. I am sure it is something I am doing wrong but I can't seem to locate the problem. The error message I am getting is: No appenders could be found for logger. Please initialize the log4j system properly . Here is the log4j file: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd !-- For Ant build -- log4j:configuration !-- order of elements: renderer*, appender*, (category | ...) , root -- appender name=LF5 class=org.apache.log4j.lf5.LF5Appender param name=MaxNumberOfRecords value=1000/ /appender appender name=file class=org.apache.log4j.RollingFileAppender param name=file
Re: Comments and Questions section of your book
Thus, I am facing a similar question albeit of different scale. Do we reprint or wait until the next edition is ready? It seems more reasonable to reprint the book instead of waiting for the next edition to be ready in 7+ months. If it's 7 months away, then definitely reprint. At least my decision is made :) Regards Milind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: New issue on Log4J initialization
Can you (or someone)explain your first statement (I'd change your classpath to be no more than a single period)? I have both installed on my machine however, I only run one at a time depending on what I am working on. My app does not use struts or anything else requiring commons-logging. Jake, Enjoy your vacation! And thanks again. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 11:49 AM To: Log4J Users List Yikes. I'd change your classpath to be no more than a single period. Set the classpath as needed in scripts. That way, you won't force libraries that aren't needed or collide with other libraries on every app you run. Just to be clear. Are you running Tomcat or Websphere? I can't tell you what the behavior in Websphere will be. Tomcat should definitely work for logging, though. BTW, what does your app consist of? Does it use Struts or anything else requiring commons-logging? That's the most evil invention to come out of the Apache project. In my experience, it just messes up everything. If this is an issue with commons-logging, you'll have to take it up with them. BTW, I will be leaving for a mini vacation shortly, so someone else is probably going to have to take the reins on this one if you require more help. good luck! Jake At 11:11 AM 8/8/2003 -0400, you wrote: Actually that is the message I am getting (I just abbreviated it a bit). In my application the log4j.jar file does not exist in the common/lib directory of Tomcat. This file only exists in the web-inf/lib directory of my application. Could this be attributed to my environmental settings: .;E:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\ldap.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jndi.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\fscontext.jar; E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar; E:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8;E:\istrobe20jars\dom4j.jar; E:\Tomcat 4.1\common\lib\servlet.jar; E:\Tomcat 4.1\bin\bootstrap.jar; E:\Sandbox\build\classes; C:\j2sdk1.4.1_01\bin; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\ant.jar; E:\Ant1.5.3\apache-ant-1.5.3-1\lib\optional.jar Thanks for hanging in there. Sincerely, Tim -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 10:57 AM To: Log4J Users List There doesn't appear to be anything wrong with your log4j.xml (except that you should use level rather than priority, but that isn't the issue here). Note that the error you've mentioned in previous emails is not an issue here... Log4j: WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax). Please initialize the log4j system properly. I'd bet that goes away if you remove log4j.jar from CATALINA_HOME/common/lib (please test this out). Having log4j.jar in WEB-INF/lib of your application provides for a separate logging environment since it is in a distinct classloader. I'm at a loss as to why you are not seeing debug message? You are running code that does logger.debug(), right? Anyone else have a clue what is happening here? Jake At 09:49 AM 8/8/2003 -0400, you wrote: Can anyone see anything wrong with this log4j.xml file? For some reason I cannot get lof4j to initialize and it's driving me crazy. I am sure it is something I am doing wrong but I can't seem to locate the problem. The error message I am getting is: No appenders could be found for logger. Please initialize the log4j system properly . Here is the log4j file: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd !-- For Ant build -- log4j:configuration !-- order of elements: renderer*, appender*, (category | ...) , root -- appender name=LF5 class=org.apache.log4j.lf5.LF5Appender param name=MaxNumberOfRecords value=1000/ /appender appender name=file class=org.apache.log4j.RollingFileAppender param name=file value=build.log/ param name=maxBackupIndex value=3/ param name=maxFileSize value=100KB/ layout class=org.apache.log4j.TTCCLayout/ /appender !-- if using this in ant, be sure the java mail libraries are avaiable -- appender name=mail class=org.apache.log4j.net.SMTPAppender param name=Threshold value=debug/ param name=SMTPHost value=bh1.compuware.com/ param name=bufferSize value=1/ param name=to value=[EMAIL PROTECTED]/ param name=from value=[EMAIL PROTECTED]/ param name=subject value=Ant test/ layout class=org.apache.log4j.HTMLLayout/ /appender appender name=STDOUT
RE: how to catch exception messages in log4j.
http://jakarta.apache.org/log4j/docs/index.html -- Thomas | -Original Message- | From: nraokonjeti [mailto:[EMAIL PROTECTED] | Sent: 06 August 2003 12:20 | To: [EMAIL PROTECTED] | Subject: how to catch exception messages in log4j. | | | hi all, | I have one application. I have to catch Exception in my Application. | I want to store exception in my logger file. I have written | explicitely one logger file. | | regards | nr konjeti | | | - | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | | * Copyright ERA Technology Ltd. 2003. (www.era.co.uk). All rights reserved. The information supplied in this Commercial Communication should be treated in confidence. No liability whatsoever is accepted for any loss or damage suffered as a result of accessing this message or any attachments. This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]