Re: Help needed : Log4J with servlets
The problem is that Category takes a String, not a class. Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
where to get The Log Tag Library from?
hi everybody, i tried to download The Log Tag Library serveral times, but the site seems to be down. is it mirrored somewhere or where can i get this taglib from? thanx for your help, oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java org.apache.log4j.performance.Logging Undeclared prefix: log4j:configuration
Hello, This is due to a missing namespace declaration. Change log4j:configuration to log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' Regards, Ceki ps: I'll fix this for the next release. At 12:46 13.06.2001 +0800, Liang Sun wrote: Hi, I tried to run java org.apache.log4j.performance.Logging with sample1.xml in the log4j 1.1.2 bundle but got this error. If I change the line log4j:configuration to configuration I'm able to run the test with a few warning. I've checked the local copy of log4j.dtd and it looks fine, no typo bug like logj:configuration. I've attached sample1.xml below the error messages. Where did I go wrong ? java org.apache.log4j.performance.Logging /h liangsun/sample1.xml 10 10 10 Warning: validation was turned on but an org.xml.sax.ErrorHandler was not set, which is probably not what is desired. Parser will use a default ErrorHandler to print the first 10 errors. Please call the 'setErrorHandler' method to fix this. Error: URI=jar:file:/home/liangsun/java/JBoss-2.2.1_Jetty3.1.RC4/jboss/lib/ext/l og4j.jar!/org/apache/log4j/xml/log4j.dtd Line=4: Undeclared prefix: log4j:confi guration. log4j:ERROR Could not parse input stream [java.io.FileInputStream@21b6d]. java.lang.NullPointerException at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:523) at org.apache.crimson.parser.Parser2.parse(Parser2.java:304) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433) at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl .java:179) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java :585) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java :520) at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:5 99) at org.apache.log4j.performance.Logging.init(Logging.java:264) at org.apache.log4j.performance.Logging.main(Logging.java:225) log4j:ERROR No appenders could be found for category (A0123456789.B0123456789.C0 123456789). log4j:ERROR Please initialize the log4j system properly. actual time: 1900.0 ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration debug=false appender name=STDOUT class=org.apache.log4j.FileAppender param name=File value=System.out / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p [%t] %C{2} (%F:%L) - %m%n/ /layout /appender category name=org.apache.log4j.xml priority value=info / /category root priority value =debug / appender-ref ref=STDOUT / /root /log4j:configuration -- Ceki Gülcü - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help needed : Log4J with servlets
Amit, What's error being generated? Ceki At 14:22 13.06.2001 +0530, you wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help needed : Log4J with servlets
I want to log the messages into a file 'logfile.txt'. The name of this file other setting are present in 'sample1.xml' The java program compiles (into servlet) without any error. There is no error in the execution of the servlet. But log log is being generated. Even the file logfile.txt is not being created. Please help. Thanks, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:37 PM To: LOG4J Users Mailing List Subject: RE: Help needed : Log4J with servlets Amit, What's error being generated? Ceki At 14:22 13.06.2001 +0530, you wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit ___ _ Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - 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: Help needed : Log4J with servlets
Hi, I'm using following XML file for configuring Log4J (thru' servlets) - ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%5p [%t] (%F:%L) - %m%n/ /layout /appender appender name=LogFile class=org.apache.log4j.RollingFileAppender param name=File value=logFile.txt/ param name=MaxFileSize value=100KB/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%p %t %c - %m%n/ /layout /appender category name=assign4Servlet appender-ref ref=STDOUT/ appender-ref ref=LogFile/ priority value=DEBUG/ /category root priority value=DEBUG/ /root /log4j:configuration - The name of my servlet is 'assign4Servlet'. When the servlet is executed, I get the following error message: = log4j:ERROR No appenders could be found for category (assign4Servlet). log4j:ERROR Please initialize the log4j system properly. = Why am I getting this message inspite of having specified 2 appenders to category 'assign4Servlet' Regards, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:37 PM To: LOG4J Users Mailing List Subject: RE: Help needed : Log4J with servlets Amit, What's error being generated? Ceki At 14:22 13.06.2001 +0530, you wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit ___ _ Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import
RE: STMPAppende.BufferSize to control logging events per e-mail?
...for every logging event (error, fatal priority). Is this... Ahh, there's your issue. The mail appender uses a Threshold value to trigger the send of the email, so... If you have a buffer size of 100, then log 150 debug messages, only the last 100 debug messages are buffered. If you then log an error message, the last 99 debug and that error message would be in the sent email. At this point the buffer is empty. If you log 3 more debug messages, then another error, this again triggers an email, since there are only 4 messages in the buffer, the sent email will only contain those 4 messages. SO: If you log 5 error's in a row, you will get 5 emails each with only one message in them. Got it? BTW the threshold can be set as a configuration option. The intent with the mail appender is that error (the default threshold) level messages should be rare in a system, and only really important events shoudl cause email to be sent, otherwise it's just a good spam generator! Regards John Volkar -Original Message- From: Renaud Waldura [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 12, 2001 4:32 PM To: [EMAIL PROTECTED] Subject: STMPAppende.BufferSize to control logging events per e-mail? Dear Log4j Users, I was hoping the BufferSize property of the SMTPAppender would control the number of logging events sent in one e-mail message. As quoted from the Javadocs: The number of logging events delivered in this e-mail depend on the value of BufferSize option. But it doesn't seem to work: I get one e-mail message for every logging event (error, fatal priority). Is this a mis-configuration on my part? A bug? How do I control how many logging events are sent per e-mail message? --Renaud - 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]
log4j: ERROR No appenders could be found for category though I Have specified an appender ?!
Hello, No answer on my previous post... could somebody please help me on that error ? I really do not understand why I get the no appenders could be found... though I have specified an appender for the category... Thanks, Axelle. -Message d'origine- De : Apvrille, Axelle Objet : log4j: ERROR No appenders could be found for category... Hi, I'm sorry I have to ask this question again, but I haven't seen the exact answer to my problem or understood the answers... (?) I've got the following complaints from log4j : log4j:ERROR No appenders could be found for category (worm.gui.TimestamperGUI). log4j:ERROR Please initialize the log4j system properly. I've read from the troubleshooting guide this is because there's no appenders attached to my category or its ancestors. But I've done that ! My configuration file is : log4j.rootCategory=DEBUG,MyFileAppender,MyConsoleAppender [..Definition of MyFileAppender and MyConsoleAppender...] log4j.category.worm=DEBUG,MyFileAppender, MyConsoleAppender Isn't that last line attach worm category to my appenders ? If worm is an ancestor of worm.gui.TimestampGUI, this should be okay ? --- Other maybe useful information : I'm passing my configuration file to the program through a system property : java ... -Dlog4j.conf.file=log.properties worm.gui.TimestampGUI Then, in my application, I've got : package worm.gui; [...] import org.apache.log4j.Category; import org.apache.log4j.PropertyConfigurator; public class TimestampGUI { static Category cat = Category.getInstance(TimestamperGUI.class.getName()); [...] public static void main(String args[]){ cat.debug(-- main()); try { // setting up trace file PropertyConfigurator.configure(System.getProperty(log4j.conf.file)); cat.info(Trace controller starts.); } catch(NullPointerException exp){ // no logging configuration file has been specified // we disable logging Category.getDefaultHierarchy().disableAll(); } } } Thanks for any explanation, I haven't understood other answers... Axelle. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: different log files for different users on UNIX
Do the users need to see the log? If not why not just include a user identifier and parse the log if you need to know information for a specific user. Sounds like a mess otherwise. You could end up with too many file handles for the os. Aaron -Original Message- From: Thilo Schottelius [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 12, 2001 5:03 AM To: 'LOG4J Users Mailing List' Subject: RE: different log files for different users on UNIX Dear Steffen, one solution would be to create a category for every user: String user=xyz myCat=Category.getInstance(myClass+user); Then you can add the file appender for this category concerning to the users home directory. You may receive the user name from your servlet or via JAVA call: name = System.getProperty(user.name); Thilo -Original Message- From: Steffen Schlachter [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 12. Juni 2001 10:48 To: '[EMAIL PROTECTED]' Subject: different log files for different users on UNIX Hi! We are using log4j with Tomcat. We are currently using multiple instances of Tomcat on one UNIX box with one properties file. The problem is that we want to log the output separately for every user in his own directory. So the question is: Is there anything like log4j.appender.A1.File=/export/home/$USER/logfile.log where I can specify that the output for logging goes to a user specific directory, i.e. $USER being an environment variable on UNIX. (We're currently running SunOS.) Thanks a lot for you help, Steffen - 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]
AW: Appender that sends a mail
Sorry, I found the SMTPAppender by myself. Sven -Ursprüngliche Nachricht- Von: Scheil, Sven Gesendet am: Mittwoch, 13. Juni 2001 14:40 An: 'LOG4J Users Mailing List' Betreff: Appender that sends a mail Hi! I'm looking for an appender that sends me a mail when a fatal error is logged. Is such an appender existing? Regards Sven - 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: Help needed : Log4J with servlets
Amit, Here is some sample code of how we have used Log4J in servlets. public class StartupServlet extends HttpServlet { static Category cat = Category.getInstance(StartupServlet.class.getName()); public void init() { URL propsURL = Util.configureLog4j(); PropertyConfigurator.configure(propsURL); cat.info( Starting the app); } ... } //here is the Util class public class Util { public static URL configureLog4j() { ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL propertiesURL = loader.getResource(log4j.properties); return propertiesURL; } } Thanks Zeba Amit Vaidya wrote: Hi, If following code is valid Category cat = Category.getInstance(NameOfTheServlet.class.getName()); then, could you please give me an example of how to use Log4J with servlets? I need to use XML file as configuration file which should be parsed thru' servlet and necessary logging should be done. Currently I've used the following code (inside doPost method): --- static Category cat = Category.getInstance(assign4Servlet.class.getName()); try { URL url = getServletConfig().getServletContext().getResource(/sample1.xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(url.toExternalForm()); DOMConfigurator.configure(doc.getDocumentElement()); -- some servlet code -- cat.info(Inside doPost method of the servlet); cat.debug(Inside doPost method of the servlet); } catch(ParserConfigurationException eP) { } catch(SAXException eS) { } file sample1.xml is in the same directory as the servlet class file. But there is no log being generated. What could be the problem? Thanks regards, Amit Amit Vaidya Infosys® Pune, India Tel : 91-2139-32801 (outside Pune) 95-2139-32801 (from Pune) Ext : 4342 -Original Message- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 2:20 PM To: LOG4J Users Mailing List; [EMAIL PROTECTED] Subject: Re: Help needed : Log4J with servlets At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe,
RE: Appender that sends a mail
org.apache.log4j.net.SMTPAppender By default it sends it on ERROR or above, but you can change the trigger to FATAL if you want. -Jim Moore -Original Message- From: Scheil, Sven [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 8:40 AM To: 'LOG4J Users Mailing List' Subject: Appender that sends a mail Hi! I'm looking for an appender that sends me a mail when a fatal error is logged. Is such an appender existing? Regards Sven - 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: Configuration problems
Dear Thomas, you forget to assign the appender to your category: -appender name | log4j.category.test1=test1 ^ | -| (category) Thilo -Original Message- From: Thomas Tuft Muller [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 13. Juni 2001 14:50 To: [EMAIL PROTECTED] Subject: Configuration problems Hi, I'm trying to log messages for separate categories to separate appenders (and to no others), and I want to configure it statically and not programmatically. log4j.rootCategory=debug, main log4j.appender.main=org.apache.log4j.ConsoleAppender log4j.appender.main.layout=org.apache.log4j.PatternLayout log4j.appender.test1=org.apache.log4j.FileAppender log4j.appender.test1.File=c:\\temp\\test1.log log4j.appender.test1.layout=org.apache.log4j.PatternLayout ... does not work. Test1 is never initialized. log4j.rootCategory=debug, main, test1 log4j.appender.main=org.apache.log4j.ConsoleAppender log4j.appender.main.layout=org.apache.log4j.PatternLayout log4j.appender.test1=org.apache.log4j.FileAppender log4j.appender.test1.File=c:\\temp\\test1.log log4j.appender.test1.layout=org.apache.log4j.PatternLayout Does not do what I want, since everything logged to root is appended to test1, and I only want the Category 'test1' to log to the 'test1.log' file. I can do it programmatically like this: Category test1 = Category.getInstance( test1 ); test1.addAppender( new FileAppender( new PatternLayout(), c:\\temp\\test1.log ) ); test1.setAdditivity( false ); But this takes away the advantage of configuring all logging one place. Any ideas? Another thing; the documentation does not seem to have an exhaustive list of all possible prefined properties. Or does it? -- Thomas * Copyright ERA Technology Ltd. 2001. (www.era.co.uk). All rights reserved. Confidential. No liability whatsoever is accepted for any loss or damage suffered as a result of accessing this message or any attachments. - 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: different log files for different users on UNIX
Yes, you are right it was a requirement that each user have a log; however, I make and change requirements all day long, and this is one I'd probably change. I'm not immediately sure why anyone would want to do this. If you need to do reports, store the info in the database. You'll never be able to merge the data in thousands of logs. If you want to be able to find errors quickly for a user, then having thousands of directories and files isn't a good idea either. But the situation sounds less scarry. I looks like he's talking about files for os users who happen to be on the site? I'm not so worried about the file issue. But you can imagine a situtation where the webserver would be serving and reading files, the logger could be buffering the logs of thousands of users, and who knows what else might be going on. Solaris would be able to handle it though. Aaron -Original Message- From: Thilo Schottelius [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 8:12 AM To: 'LOG4J Users Mailing List' Subject: RE: different log files for different users on UNIX Dear Aaron, I thought that it was the requrirement from Steffen, that every user has his own log: ---snip The problem is that we want to log the output separately for every user in his own directory --- The file handle problem should also not arise, because I would think that the log files are closed after writing, or am I wrong? Thilo -Original Message- From: Aaron Smuts [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 13. Juni 2001 13:54 To: LOG4J Users Mailing List Subject: RE: different log files for different users on UNIX Do the users need to see the log? If not why not just include a user identifier and parse the log if you need to know information for a specific user. Sounds like a mess otherwise. You could end up with too many file handles for the os. Aaron -Original Message- From: Thilo Schottelius [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 12, 2001 5:03 AM To: 'LOG4J Users Mailing List' Subject: RE: different log files for different users on UNIX Dear Steffen, one solution would be to create a category for every user: String user=xyz myCat=Category.getInstance(myClass+user); Then you can add the file appender for this category concerning to the users home directory. You may receive the user name from your servlet or via JAVA call: name = System.getProperty(user.name); Thilo -Original Message- From: Steffen Schlachter [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 12. Juni 2001 10:48 To: '[EMAIL PROTECTED]' Subject: different log files for different users on UNIX Hi! We are using log4j with Tomcat. We are currently using multiple instances of Tomcat on one UNIX box with one properties file. The problem is that we want to log the output separately for every user in his own directory. So the question is: Is there anything like log4j.appender.A1.File=/export/home/$USER/logfile.log where I can specify that the output for logging goes to a user specific directory, i.e. $USER being an environment variable on UNIX. (We're currently running SunOS.) Thanks a lot for you help, Steffen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configuration problems
Thanx Can's say that this was easy extractable from the manual. BTW, your suggestion does not work, because you have to state the default priority as well log4j.category.cat name=min-priority, appender-name I still miss the exhaustive list of properties. Is it possible to set the additivity flag from via the properties file? -- Thomas | -Original Message- | From: Thilo Schottelius [mailto:[EMAIL PROTECTED]] | Sent: 13 June 2001 14:08 | To: 'LOG4J Users Mailing List' | Subject: RE: Configuration problems | | | Dear Thomas, | you forget to assign the appender to your category: | -appender name | | | log4j.category.test1=test1 |^ || | -| (category) | | Thilo | | -Original Message- | From: Thomas Tuft Muller [mailto:[EMAIL PROTECTED]] | Sent: Mittwoch, 13. Juni 2001 14:50 | To: [EMAIL PROTECTED] | Subject: Configuration problems | | | Hi, | | I'm trying to log messages for separate categories to separate appenders | (and to no others), and I want to configure it statically and not | programmatically. | | log4j.rootCategory=debug, main | log4j.appender.main=org.apache.log4j.ConsoleAppender | log4j.appender.main.layout=org.apache.log4j.PatternLayout | | log4j.appender.test1=org.apache.log4j.FileAppender | log4j.appender.test1.File=c:\\temp\\test1.log | log4j.appender.test1.layout=org.apache.log4j.PatternLayout | | ... does not work. Test1 is never initialized. | | log4j.rootCategory=debug, main, test1 | log4j.appender.main=org.apache.log4j.ConsoleAppender | log4j.appender.main.layout=org.apache.log4j.PatternLayout | | log4j.appender.test1=org.apache.log4j.FileAppender | log4j.appender.test1.File=c:\\temp\\test1.log | log4j.appender.test1.layout=org.apache.log4j.PatternLayout | | Does not do what I want, since everything logged to root is appended to | test1, and I only want the Category 'test1' to log to the | 'test1.log' file. | | I can do it programmatically like this: | | Category test1 = Category.getInstance( test1 ); | test1.addAppender( new FileAppender( new PatternLayout(), | c:\\temp\\test1.log ) ); | test1.setAdditivity( false ); | | But this takes away the advantage of configuring all logging one place. | | Any ideas? | | Another thing; the documentation does not seem to have an | exhaustive list of | all possible prefined properties. Or does it? | | -- | | Thomas | | | | * | Copyright ERA Technology Ltd. 2001. (www.era.co.uk). All rights reserved. | Confidential. No liability whatsoever is accepted for any loss or damage | suffered as a result of accessing this message or any attachments. | | - | 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] | | * Copyright ERA Technology Ltd. 2001. (www.era.co.uk). All rights reserved. Confidential. No liability whatsoever is accepted for any loss or damage suffered as a result of accessing this message or any attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Appender that sends a mail
log4j.appender.A3.EvaluatorClass=MyTriggeringEventEvaluator public class MyTriggeringEventEvaluator implements TriggeringEventEvaluator { /** * Is this the triggering event? */ public boolean isTriggeringEvent(LoggingEvent event) { // whatever criteria you want if (event == null) { return false; } else { return event.priority.isGreaterOrEqual(Priority.ERROR); } } } Does it hang simply because of adding to A3's buffer, or when it tries to actually send the email? -Jim Moore -Original Message- From: Scheil, Sven [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 9:58 AM To: 'LOG4J Users Mailing List' Subject: AW: Appender that sends a mail I'am trying org.apache.log4j.net.SMTPAppender as the 3rd appender in my log4j conf file. But every time appending the SMTPAppender my application consiting of jsp/beans and servlet hangs up. I have no idea? The log4j.jar is in the web servers classpath. I've appended my log4j config file. 2nd Question: What do I have to do in detail to change the triggering event? Regards sven log4j.rootCategory=DEBUG, A1, A2, A3 # A1 is set to be a FileAppender which outputs to System.out. log4j.appender.A1=org.apache.log4j.FileAppender log4j.appender.A1.File=System.out # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout # The conversion pattern uses format specifiers. You might want to # change the pattern an watch the output layout change. log4j.appender.A1.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %-5p [%t] %37c %3x %l - %m%n # A2 is set to be a FileAppender which outputs to System.out. log4j.appender.A2=org.apache.log4j.FileAppender log4j.appender.A2.File=/usr1/kunden/eva_mp/Web-inf/Log/EVAapp_mp.log #log4j.appender.A2.File=EVAapp_mp.log # A2 uses PatternLayout. log4j.appender.A2.layout=org.apache.log4j.PatternLayout # The conversion pattern uses format specifiers. You might want to # change the pattern an watch the output layout change. log4j.appender.A2.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %-5p [%t] %37c %3x %l - %m%n # A3 is set to be a SMTPAppender which outputs to mail log4j.appender.A3=org.apache.log4j.net.SMTPAppender [EMAIL PROTECTED] [EMAIL PROTECTED] log4j.appender.A3.Subject=EVA Fehler log4j.appender.A3.SMTPHost=194.164.4.244 #log4j.appender.A3.BufferSize=100 #log4j.appender.A3.EvaluatorClass # A3 uses PatternLayout. #log4j.appender.A3.layout=org.apache.log4j.PatternLayout # The conversion pattern uses format specifiers. You might want to # change the pattern an watch the output layout change. #log4j.appender.A3.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %-5p [%t] %37c %3x %l - %m%n -Ursprüngliche Nachricht- Von: Jim Moore [mailto:[EMAIL PROTECTED]] Gesendet am: Mittwoch, 13. Juni 2001 15:04 An: 'LOG4J Users Mailing List' Betreff: RE: Appender that sends a mail org.apache.log4j.net.SMTPAppender By default it sends it on ERROR or above, but you can change the trigger to FATAL if you want. -Jim Moore -Original Message- From: Scheil, Sven [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 8:40 AM To: 'LOG4J Users Mailing List' Subject: Appender that sends a mail Hi! I'm looking for an appender that sends me a mail when a fatal error is logged. Is such an appender existing? Regards Sven - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multiple log files with SocketServer
When you say client group, do you mean different machines that are using socketAppender? If that is the case, you can give a directory as a command line argument (see javadoc on SocketServer) to socketServer. In this dir you can put several config files (hostname.lcf i.e, 192.215.113.16.lcf). The socketserver will read the appropriate config file and use it to log loggingEvent coming from the particular host. This way you can specify different files/appenders in each of the lcf files and the log will go to different files depending on the 'client group' Hope this helps :) -Original Message- From: Atte A [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 6:37 AM To: [EMAIL PROTECTED] Subject: Multiple log files with SocketServer Hi! (Using Visual Age 3.5 on NT) I use SocketAppender and listen with SocketServer which logs to a file. It works well. But now I want to log to several files on server, depending on which client group that want to log. I use the SocketAppender in the following prop. config file (Trace1.lcf): log4j.rootCategory=DEBUG, SOCKETSERV log4j.category.org.apache.log4j.net=DEBUG log4j.appender.SOCKETSERV=org.apache.log4j.net.SocketAppender log4j.appender.SOCKETSERV.RemoteHost=localhost log4j.appender.SOCKETSERV.Port=9991 I do the following in a method everytime to send messages to the socket: PropertyConfigurator.configure(C:\\Trace1.lcf); Category cat = Category.getInstance(SOCKETSERV); cat.info(Tracing + message); Is this the right way to do so? I have the following prop. config file (localhost.lcf) stated in SocketServer second argument in main(): log4j.rootCategory=debug, A1 log4j.appender.A1=org.apache.log4j.RollingFileAppender log4j.appender.A1.File=C:\\localhost.log log4j.appender.A1.MaxFileSize=1000KB # Keep one backup file log4j.appender.A1.MaxBackupIndex=5 log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss.SSS} - %m%n%n Every client group have to have a logfile that only belongs to that group. How can I log to diffent files in SocketServer, one for each client group? Do I have to have several SocketAppenders stated in my config file, one for each client group? Please...Help me...Don't hesitate to contact med directly. /Atte _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Do I need to use multiple hierarchies, and how?
Hi, I apologize, in advance, if this question has already been answered. If it has, please point me to the existing reply. I am using worker threads in the same JVM and would like each thread to maintain its own log file. Other than that, I would like to use the same categories and layouts. Only the appenders would be thread specific. Multiple hierarchies were mentioned in the introductory manual as an advanced topic. Do multiple hierarchies make sense in this situation? Is there an example of multiple hierarchy usage? Is there more documentation on this topic? Thank You, Jim Prokash - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Logging problem from Applet
Hi, I have problems in logging from an Applet. The initialization is always done when an applet is started. Does anybody have an example? Zsolt -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7221873 Fax: +49-711-7871017 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
class loading problems
I am experiencing classpath/classload problems when trying to use my own appender class and jboss EJB server. jboss has its own way of dynamically creating the classpath during system startup. It dynamically reads all the jars in a specified directory and adds them to it's classpath. It doesn't export the classpath to the classpath variable. The problem is that our homegrown appender is included with all of our other classes in the jar that is deployed by the server. When log4j attempts to initialize the appender, it can't find the class even though it is in the jar file along with all our other beans, etc. So does this indicate the log4j isn't getting its class loader from the correct source. Or do we have to go back and re-arrange our package structure and create two seperate jars. Jboss hates it when you have duplicate classes in the classpath log4j.appender.errorSMTP=com.earthcars.log.EarthcarsSMTPAppender - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
One category, different priorities, different outputs
I have a category 'categoryA' that needs to log to different outputs based on their priority. The following piece of code doesn't work log4j.category.categoryA=ERROR, outputA log4j.category.categoryA=DEBUG, outputB The second line overwrites the previous line, so the previous line is not considered at all. I need a way to output to outputB if the priority is greater than debug and to outputA and outputB if the priority is greater than error. Can somebody tell me how to accomplish this. Thanks in advance. Van - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: One category, different priorities, different outputs
Anshul, Sorry for the incomplete details, Threshold option will not work because I have another category that also wants to log to this outputA, all messages that are with priority info or higher. For example, log4j.category.categoryA=ERROR, outputA log4j.category.categoryA=DEBUG, outputB log4j.category.categoryB=INFO, outputA Now, if I put an ERROR threshold on outputA and change the properties like shown below log4j.category.categoryA=DEBUG, outputB, outputA log4j.category.categoryB=INFO, outputA then all my messages from categoryB will not be output to outputA because of the ERROR threshold. I also briefly looked into the implementation of the Category class, It looks like what I want is not possible. I could be wrong, since I don't know all that's going on inside log4j. Anyone, any thoughts on this? Thanks Van -Original Message- From: Anshul Chhabra [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 1:00 PM To: LOG4J Users Mailing List Subject: RE: One category, different priorities, different outputs Van Have you considered using Thresholds for appenders? Looks to me like that might solve your problem. Anshul -Original Message- From: Veerappan Saravanan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 4:30 PM To: '[EMAIL PROTECTED]' Subject: One category, different priorities, different outputs I have a category 'categoryA' that needs to log to different outputs based on their priority. The following piece of code doesn't work log4j.category.categoryA=ERROR, outputA log4j.category.categoryA=DEBUG, outputB The second line overwrites the previous line, so the previous line is not considered at all. I need a way to output to outputB if the priority is greater than debug and to outputA and outputB if the priority is greater than error. Can somebody tell me how to accomplish this. Thanks in advance. Van - 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: One category, different priorities, different outputs
Try priority match instead of threshold. That should allow you to have the outputA include INFO from categoryB and ERROR messges from categoryA. Meanwhile outputB would have DEBUG messages from categoryA - Original Message - From: Veerappan Saravanan [EMAIL PROTECTED] To: 'LOG4J Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, June 13, 2001 6:17 PM Subject: RE: One category, different priorities, different outputs Anshul, Sorry for the incomplete details, Threshold option will not work because I have another category that also wants to log to this outputA, all messages that are with priority info or higher. For example, log4j.category.categoryA=ERROR, outputA log4j.category.categoryA=DEBUG, outputB log4j.category.categoryB=INFO, outputA Now, if I put an ERROR threshold on outputA and change the properties like shown below log4j.category.categoryA=DEBUG, outputB, outputA log4j.category.categoryB=INFO, outputA then all my messages from categoryB will not be output to outputA because of the ERROR threshold. I also briefly looked into the implementation of the Category class, It looks like what I want is not possible. I could be wrong, since I don't know all that's going on inside log4j. Anyone, any thoughts on this? Thanks Van -Original Message- From: Anshul Chhabra [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 1:00 PM To: LOG4J Users Mailing List Subject: RE: One category, different priorities, different outputs Van Have you considered using Thresholds for appenders? Looks to me like that might solve your problem. Anshul -Original Message- From: Veerappan Saravanan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 4:30 PM To: '[EMAIL PROTECTED]' Subject: One category, different priorities, different outputs I have a category 'categoryA' that needs to log to different outputs based on their priority. The following piece of code doesn't work log4j.category.categoryA=ERROR, outputA log4j.category.categoryA=DEBUG, outputB The second line overwrites the previous line, so the previous line is not considered at all. I need a way to output to outputB if the priority is greater than debug and to outputA and outputB if the priority is greater than error. Can somebody tell me how to accomplish this. Thanks in advance. Van - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed : Log4J with servlets
Sorry about that. My mistake. [EMAIL PROTECTED] 06/13/01 06:50pm At 17:30 13.06.2001 +1000, SCOTT FARQUHAR wrote: The problem is that Category takes a String, not a class. Hello Scott, Categoty.getInstance takes a string or a class. Assuming that the MyFooBar class is in the ch.qos package. The following a strictly equivalent: Category x = Category.getInstance(ch.qos.MyFooBar); Category x = Category.getInstance(MyFooBar.class.getName()); Category x = Category.getInstance(MyFooBar.class); Category cat = Category.getInstance(NameOfTheServlet.class.getName()); If you turn off friendly error messages in IE, you would have been able to see this error. Scott [EMAIL PROTECTED] 06/13/01 01:15pm Hi, I'm trying to use log4J with servlets (running on weblogic) When I try to create a category instance inside my servlet, -- Category cat = Category.getInstance(NameOfTheServlet.class); -- This causes internal server error. What exactly could be the problem? I've imported the following packages in my servlet: -- import org.apache.log4j.xml.DOMConfigurator; import org.apache.log4j.Category; import org.apache.log4j.Priority; -- The java file compiles without any warnings or errors but the servlet during runtime gives 'Internal server error'. I would really appreciate a sample code that illustrates the usage of log4J with servlets. Thanks regards, Amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This message has been scanned by MailSweeper. --- --- This e-mail is solely for the use of the intended recepient and may contain information which is confidential or privileged. Unauthorised use of its contents is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and then delete the original e-mail. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: class loading problems
This is just an idea, but after looking through the source code for the BasicConfigurator and DOMConfigurator, I noticed that they aren't using the JDK 1.2+ construct Thread.currentThread().getContextClassLoader().forName(). I'm not a JBoss user, but from what I know about Classloaders your Appender won't be loaded if the log4J.jaris in an ancestor classloader. In JDK1.2 and above, Classloading goes upwards. You can find out using a simple loop: for (ClassLoader klassldr = Class.forName("org.apache.log4j.BasicConfigurator").getClassLoader(); klassldr != null; klassldr = klassldr.getParent()) System.out.println (klassldr); for (ClassLoader klassldr = Class.forName("com.earthcars.log.EarthcarsSMTPAppender").getClassLoader(); klassldr != null; klassldr = klassldr.getParent()) System.out.println (klassldr); If I'm right, we probably need to put some code into Log4J where we delegate the classloading to a stub object that gets loaded with a java version check (if 1.1 use Class.forName, if 1.2 use Thread.currentThread().getContextClassLoader().forName()). -Chris - Original Message - From: "Gray Jones" [EMAIL PROTECTED] To: "LOG4J Users Mailing List" [EMAIL PROTECTED] Sent: Wednesday, June 13, 2001 2:34 PM Subject: class loading problems I am experiencing classpath/classload problems when trying to use my own appender class and jboss EJB server. jboss has its own way of dynamically creating the classpath during system startup. It dynamically reads all the jars in a specified directory and adds them to it's classpath. It doesn't export the classpath to the classpath variable. The problem is that our homegrown appender is included with all of our other classes in the jar that is deployed by the server. When log4j attempts to initialize the appender, it can't find the class even though it is in the jar file along with all our other beans, etc. So does this indicate the log4j isn't getting its class loader from the correct source. Or do we have to go back and re-arrange our package structure and create two seperate jars. Jboss hates it when you have duplicate classes in the classpath log4j.appender.errorSMTP=com.earthcars.log.EarthcarsSMTPAppender - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: class loading problems
Oops... ignore the part about forName() on the ClassLoader... I meant loadClass(). In addition, the code would look like: ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = getClass().getClassLoader(); } return loader.loadClass([class name]); -Chris - Original Message - From: Christopher Taylor To: LOG4J Users Mailing List Sent: Wednesday, June 13, 2001 4:45 PM Subject: Re: class loading problems This is just an idea, but after looking through the source code for the BasicConfigurator and DOMConfigurator, I noticed that they aren't using the JDK 1.2+ construct Thread.currentThread().getContextClassLoader().forName(). I'm not a JBoss user, but from what I know about Classloaders your Appender won't be loaded if the log4J.jaris in an ancestor classloader. In JDK1.2 and above, Classloading goes upwards. You can find out using a simple loop: for (ClassLoader klassldr = Class.forName("org.apache.log4j.BasicConfigurator").getClassLoader(); klassldr != null; klassldr = klassldr.getParent()) System.out.println (klassldr); for (ClassLoader klassldr = Class.forName("com.earthcars.log.EarthcarsSMTPAppender").getClassLoader(); klassldr != null; klassldr = klassldr.getParent()) System.out.println (klassldr); If I'm right, we probably need to put some code into Log4J where we delegate the classloading to a stub object that gets loaded with a java version check (if 1.1 use Class.forName, if 1.2 use Thread.currentThread().getContextClassLoader().forName()). -Chris - Original Message - From: "Gray Jones" [EMAIL PROTECTED] To: "LOG4J Users Mailing List" [EMAIL PROTECTED] Sent: Wednesday, June 13, 2001 2:34 PM Subject: class loading problems I am experiencing classpath/classload problems when trying to use my own appender class and jboss EJB server. jboss has its own way of dynamically creating the classpath during system startup. It dynamically reads all the jars in a specified directory and adds them to it's classpath. It doesn't export the classpath to the classpath variable. The problem is that our homegrown appender is included with all of our other classes in the jar that is deployed by the server. When log4j attempts to initialize the appender, it can't find the class even though it is in the jar file along with all our other beans, etc. So does this indicate the log4j isn't getting its class loader from the correct source. Or do we have to go back and re-arrange our package structure and create two seperate jars. Jboss hates it when you have duplicate classes in the classpath log4j.appender.errorSMTP=com.earthcars.log.EarthcarsSMTPAppender - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSR47 vs. log4j
I have not looked at log4j recently, but the last time I was looking for a logging facility, the docs mentioned about static classes which are not suitable for logging EJBs. -Original Message- From: Ceki Gulcu [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 13, 2001 7:00 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Fwd: JSR47 vs. log4j Greetings, Since yesterday evening a non-negligible number of requests were directed to [EMAIL PROTECTED] I find Ellis Teer's comments (included below) quite interesting. My critique of the JSR47 API can be found at: http://jakarta.apache.org/log4j/docs/critique.html If you agree with its contents, you are encouraged to send your own comments to [EMAIL PROTECTED] Thanks, Ceki Delivered-To: [EMAIL PROTECTED] Date: Tue, 12 Jun 2001 18:35:16 -0700 (PDT) From: Ellis Teer [EMAIL PROTECTED] Subject: JSR47 vs. log4j To: [EMAIL PROTECTED] To whom it may concern, I feel that the differences between log4j and the JSR47 API outlined at the following URL are significant. http://jakarta.apache.org/log4j/docs/critique.html I also feel, that rather than reinventing the wheel the JSR47 group should incorporate the log4j API rather than recreating it. The standards put forth by the JSR group will eventually replace any similarly functioning external API due to its incorporation into the JDK. For the number of people who already use log4j, such as myself, it feels that Sun by way of including this new API in the JDK is forcing users of log4j to switch. I understand that there are licensing issues but I suspect Ceki would be accommodating in this regard. In addition, by incorporating such projects into the API rather than recreating them from scratch I believe Sun will promote more projects like these to move forward rather than possibly dissuading programmers from creating new API's for fear that their work will become useless by Sun's recreation of their features in the next JDK. I point to the success of Tomcat as an example. Sincerely, -Ellis Teer - 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]