Rendered Message in JMSAppender messages
Hi, Here is my configuration (in XML) of my JMS Appender: appender name=JMS class=org.apache.log4j.net.JMSAppender param name=TopicConnectionFactoryBindingName value=cn=LoggingTopicConnectionFactory/ param name=TopicBindingName value=cn=LoggingTopic/ param name=Threshold value=DEBUG/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%-5p] [%d{DATE}] [%C.%M] - %m%n/ /layout /appender As you can see I'm using PatternLayout. The message is sent out onto JMS as a serialised java object (org.apache.log4j.spi.LoggingEvent) wrapped in an javax.jms.ObjectMessage. On the class org.apache.log4j.spi.LoggingEvent, I can use methods getMessage() and getRenderedMessage(). Both return the %m message string, but I would expect getRenderedMessage() to return the rendered message as defined in the layout in the configuration. Is this a bug, as the message should have been rendered before sending the message out on the JMS appender? Regards, Peter This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person Thank you Check us out at http://www.syntegra.com
Re: Rendered Message in JMSAppender messages
Message rendering is done prior to serialization. After serialization calling getMessage and getRenderedMessage always give the same result regardless of how you configure the server (receiving) side. Object rendering should be configured on the clients. HTH, At 09:31 20.11.2002 +, FLYNN, Peter -Syntegra UK wrote: Hi, Here is my configuration (in XML) of my JMS Appender: appender name=JMS class=org.apache.log4j.net.JMSAppender param name=TopicConnectionFactoryBindingName value=cn=LoggingTopicConnectionFactory/ param name=TopicBindingName value=cn=LoggingTopic/ param name=Threshold value=DEBUG/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=[%-5p] [%d{DATE}] [%C.%M] - %m%n/ /layout /appender As you can see I'm using PatternLayout. The message is sent out onto JMS as a serialised java object (org.apache.log4j.spi.LoggingEvent) wrapped in an javax.jms.ObjectMessage. On the class org.apache.log4j.spi.LoggingEvent, I can use methods getMessage() and getRenderedMessage(). Both return the %m message string, but I would expect getRenderedMessage() to return the rendered message as defined in the layout in the configuration. Is this a bug, as the message should have been rendered before sending the message out on the JMS appender? Regards, Peter -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Rendered Message in JMSAppender messages
Message rendering is done prior to serialization. After serialization calling getMessage and getRenderedMessage always give the same result regardless of how you configure the server (receiving) side. Object rendering should be configured on the clients. HTH, Hi Ceki, I'd always assumed the message rendering would be provided by the appender sending the LoggingEvent. If I'd had an appender with a pattern layout such as [%-5p] [%d{DATE}] [%C.%M] - %m%n, and made a call such as log.debug(Hello World), I'd expect two different strings in the serialized LoggingEvent. getMessage() would return Hello World, and getRenderedMessage() would return [DEBUG] [20 Dec 2002 10:07:00,513] [myClass.myMethod] - Hello World If the rendering is provided on the client, then how can I render the message? Do I simply build it up using the components (using LocationInformation, Message, Timestamp etc) or is there a utility class to help with this rendering? Regards, Peter This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person Thank you Check us out at http://www.syntegra.com
RE: Rendered Message in JMSAppender messages
We are talking about two completely different things. The formatting of the LoggingEvent is done by the layout attached to a given appender. I was talking about object renderers which is a different topic. On object rendering see: http://www.qos.ch/ac2001/F11-110.html (for these two links search for renderer) http://jakarta.apache.org/log4j/docs/manual.html http://www.vipan.com/htdocs/log4jhelp.html The following thread is also very likely to help: http://marc.theaimsgroup.com/?t=10376434625r=1w=2 Coming back to your question, actually I don't understand it. At 10:06 20.11.2002 +, you wrote: Message rendering is done prior to serialization. After serialization calling getMessage and getRenderedMessage always give the same result regardless of how you configure the server (receiving) side. Object rendering should be configured on the clients. HTH, Hi Ceki, I'd always assumed the message rendering would be provided by the appender sending the LoggingEvent. If I'd had an appender with a pattern layout such as [%-5p] [%d{DATE}] [%C.%M] - %m%n, and made a call such as log.debug(Hello World), I'd expect two different strings in the serialized LoggingEvent. getMessage() would return Hello World, and getRenderedMessage() would return [DEBUG] [20 Dec 2002 10:07:00,513] [myClass.myMethod] - Hello World If the rendering is provided on the client, then how can I render the message? Do I simply build it up using the components (using LocationInformation, Message, Timestamp etc) or is there a utility class to help with this rendering? Regards, Peter This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person Thank you Check us out at http://www.syntegra.com -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Why do ancestor loggers ignore level?
Hi, we've had the same problem as described by Adam Hardy in thread http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg05667.html Can't control logging via root - get all msgs despite setting priority. I still don't feel this behaviour be plausible. If levels are not inherited but assigned to loggers, why don't ancestor loggers check their level before printing a forwarded log request? Example: log4j.rootLogger=ERROR, A1 log4j.logger.myDefinedLogger=DEBUG, A2 From my point of view, myDefinedLogger.info(just an info msg); should print in A2 but not in A1 since ERROR INFO DEBUG. Nevertheless, it prints in both A1 and A2. From my point of view this violates the basic selection rule (as stated in Short introduction to log4j). What's the idea behind? . Mit freundlichem Gruß / With kind regards Alexander Ortloff Siemens AG Transportation Systems Rail Automation System Development TS RA SD 16 Ackerstr. 22 D-38126 Braunschweig Germany Fon: +49 531 226 2536 Fax: +49 531 2277 2536 MailTo:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Log4J in EJBs
Your best bet is the startup class that loads an XML file or Properties file. I recommend the former. A startup class does not have the restrictions that EJBs have. As far as runtime adjustments, there is a JMX component in the log4J library that exposes Log4J objects. I have not used it, but the concept seems sound to me. //Nicholas Follender, Ivan (HBO) [EMAIL PROTECTED] wrote:I want the properties easily accessible by the Application Server administrator so they can dynamically modify the logging configuration. This makes me want to have the log4j.properties outside of my deployed EAR/JAR. There still seems to be the problem of initialization, since for EJBs, there is no good init() method for everything (unlike a servlet). Thanks for the responses, ivan. -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 19, 2002 12:01 PM To: Log4J Users List Subject: Re: Log4J in EJBs Hello Ivan, Well, you shouldn't use File IO in an EJB app because you can't guarantee that the file can be read off the filesystem. For instance, the file could be served out of a jar file. However as long as you get an InputSream or URL of your properties or XML file, then you are fine. That means you can store your config file in a jar archive or in a JNDI directory or wherever you want. That said, I've not done too much with EJB, but, in theory, there is no problem in reading your config in EJB's. Jake Tuesday, November 19, 2002, 10:47:07 AM, you wrote: FIH Hi- FIH I want to use Log4J in my EJBs. FIH The guidance I've been getting is that EJBs should not access system files FIH (e.g. log4j.properties). FIH Is there a recommended mechanism for configuring the LogFactory for EJBs? FIH Thanks, FIH ivan. FIH == FIH This e-mail is intended only for the use of the addressees. Any copying, forwarding, printing or other use of this e-mail by persons other than the addressees is not authorized. This e-mail FIH may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, please notify us immediately by return e-mail (including the original FIH message in your reply) and then delete and discard all copies of the e-mail. Thank you. FIH -- FIH To unsubscribe, e-mail: FIH For additional commands, e-mail: -- Best regards, Jacob mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: For additional commands, e-mail: == This e-mail is intended only for the use of the addressees. Any copying, forwarding, printing or other use of this e-mail by persons other than the addressees is not authorized. This e-mail may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, please notify us immediately by return e-mail (including the original message in your reply) and then delete and discard all copies of the e-mail. Thank you. -- To unsubscribe, e-mail: For additional commands, e-mail: Nicholas Whitehead Home: (973) 377 9335 Cell: (201) 615 2716 Work: (212) 622 5639 [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site
Antw: configuring watchdog from log4j.properties
Hi Morten, read http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg05569.html and http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg05578.html This may help till log4j 1.3 is ready. Kind regards Frank-Olaf Lohmann -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Getting junk messages in log file (Followup=null) while using struts
-Original Message- From: donald larmee [mailto:[EMAIL PROTECTED]] Sent: Wed 11/20/2002 1:50 PM To: Log4J Users List Cc: Subject:RE: Getting junk messages in log file (Followup=null) while using struts Add an entry to your log4j.properties file restricting the level that the Loggers from those packages write at. Ex: log4j.logger.org.struts=ERROR log4j.logger.org.strutsx=ERROR log4.logger.some.other.struts.package=ERROR Will only allow the struts stuff to log at a level of ERROR or higher. You could also specify OFF if you really never want to see any messages from these packages. At 01:22 PM 11/20/2002 -0500, Venkat Reddy Valluri wrote: Hi Thank you very much for info, As you told I used %C and found out that it is being logged by org.strutsx.taglib.html.ExtFormTag Can you pl let me know how to prevent strus classes from logging messages Thks --Venkat -Original Message- From: donald larmee [mailto:[EMAIL PROTECTED]] Sent: Wed 11/20/2002 12:54 PM To: Log4J Users List Cc: Subject:Re: Getting junk messages in log file (Followup=null) while using struts Try putting the Logger(Category) in your pattern layout (via %c), so you can see who is doing the logging. I am assuming that the message is coming from struts (or another component/jar that it relies on), which uses the jakarta logging/commons package(which in turn will use log4j if it available.) or log4j directly. At 11:16 AM 11/20/2002 -0500, Venkat Reddy Valluri wrote: Hi, I tried to log messages using log4j1.2.7.jar in my application using struts, Here is code .. public class TestAction extends ActionBase { static Category cat = Category.getInstance(TestAction.class.getName()); private ActionForward doGetInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { -- - PropertyConfigurator.configure(/tmp/log4j.properties); cat.info(starting main); --- } } log4j.properties --- log4j.rootCategory=DEBUG, dest1 log4j.appender.dest1=org.apache.log4j.FileAppender log4j.appender.dest1.layout=org.apache.log4j.PatternLayout log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/ HH:mm:ss,SSS} [%p] [%t] - %m%n log4j.appender.dest1.File=/tmp/example.log log4j.logger.org.apache=WARN here is /tmp/example.log 20/11/2002 11:03:06,438 [INFO] [HttpProcessor[8080][3]] - starting main 20/11/2002 11:03:08,648 [DEBUG] [HttpProcessor[8080][3]] - Followup = null 20/11/2002 11:03:12,222 [DEBUG] [HttpProcessor[8080][3]] - Followup = null 20/11/2002 11:03:18,832 [DEBUG] [HttpProcessor[8080][3]] - Followup = null Here I didn't understand why Iam getting this junk mesaage Followup=null Any help greatly appreciated Thks --Venkat -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ donald h. larmee [EMAIL PROTECTED] 804.301.UTOP utopian software concepts, inc. www.utopiansoft.com +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ donald h. larmee [EMAIL PROTECTED] 804.301.UTOP utopian software concepts, inc. www.utopiansoft.com +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] winmail.dat-- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Getting junk messages in log file (Followup=null) while using struts
Hi, As you told I added these lines to log4j.properties, but still Iam getting that proble, here is log4j.proprties log4j.rootCategory=DEBUG, dest1 log4j.logger.org.strutsx=OFF log4j.logger.org.struts=OFF log4j.logger.org.apache=OFF log4j.appender.dest1=org.apache.log4j.FileAppender log4j.appender.dest1.layout=org.apache.log4j.PatternLayout log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/ HH:mm:ss,SSS} [%p] [%t] -%C%m%n log4j.appender.dest1.File=/tmp/example.log here is example.log 20/11/2002 14:15:09,923 [INFO] [HttpProcessor[8080][4]] -com.test.TestAction starting main 20/11/2002 14:15:10,063 [DEBUG] [HttpProcessor[8080][4]] -org.strutsx.taglib.html.ExtFormTagFollowup = null 20/11/2002 14:15:13,852 [DEBUG] [HttpProcessor[8080][4]] -org.strutsx.taglib.html.ExtFormTagFollowup = null Thks for your help --Venkat -Original Message- From: donald larmee [mailto:[EMAIL PROTECTED]] Sent: Wed 11/20/2002 1:50 PM To: Log4J Users List Cc: Subject:RE: Getting junk messages in log file (Followup=null) while using struts Add an entry to your log4j.properties file restricting the level that the Loggers from those packages write at. Ex: log4j.logger.org.struts=ERROR log4j.logger.org.strutsx=ERROR log4.logger.some.other.struts.package=ERROR Will only allow the struts stuff to log at a level of ERROR or higher. You could also specify OFF if you really never want to see any messages from these packages. At 01:22 PM 11/20/2002 -0500, Venkat Reddy Valluri wrote: Hi Thank you very much for info, As you told I used %C and found out that it is being logged by org.strutsx.taglib.html.ExtFormTag Can you pl let me know how to prevent strus classes from logging messages Thks --Venkat -Original Message- From: donald larmee [mailto:[EMAIL PROTECTED]] Sent: Wed 11/20/2002 12:54 PM To: Log4J Users List Cc: Subject:Re: Getting junk messages in log file (Followup=null) while using struts Try putting the Logger(Category) in your pattern layout (via %c), so you can see who is doing the logging. I am assuming that the message is coming from struts (or another component/jar that it relies on), which uses the jakarta logging/commons package(which in turn will use log4j if it available.) or log4j directly. At 11:16 AM 11/20/2002 -0500, Venkat Reddy Valluri wrote: Hi, I tried to log messages using log4j1.2.7.jar in my application using struts, Here is code .. public class TestAction extends ActionBase { static Category cat = Category.getInstance(TestAction.class.getName()); private ActionForward doGetInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { -- - PropertyConfigurator.configure(/tmp/log4j.properties); cat.info(starting main); --- } } log4j.properties --- log4j.rootCategory=DEBUG, dest1 log4j.appender.dest1=org.apache.log4j.FileAppender log4j.appender.dest1.layout=org.apache.log4j.PatternLayout log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/ HH:mm:ss,SSS} [%p] [%t] - %m%n log4j.appender.dest1.File=/tmp/example.log log4j.logger.org.apache=WARN here is /tmp/example.log 20/11/2002 11:03:06,438 [INFO] [HttpProcessor[8080][3]] - starting main 20/11/2002 11:03:08,648 [DEBUG] [HttpProcessor[8080][3]] - Followup = null 20/11/2002 11:03:12,222 [DEBUG] [HttpProcessor[8080][3]] - Followup = null 20/11/2002 11:03:18,832 [DEBUG] [HttpProcessor[8080][3]] - Followup = null Here I didn't understand why Iam getting this junk mesaage Followup=null Any help greatly appreciated Thks --Venkat -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ donald h. larmee [EMAIL PROTECTED] 804.301.UTOP utopian software concepts, inc. www.utopiansoft.com +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ donald h. larmee [EMAIL PROTECTED] 804.301.UTOP utopian software concepts, inc.
RE: log4j will search for the file log4j.xml... ???
-Original Message- i start playing with Log4j 1.2.7 and read that it automatically looks for log4j.xml Log4j developers are happy to announce the release of log4j 1.2.7. As of this release log4j will search for the file log4j.xml as well as the file log4j.properties during its initialization. I put my log4j.xml file inside my WEB-INF directory but log4j did not use it. Close! :) It needs to be in WEB-INF/classes/ - Colin MacDonald | Software Developer | Templar Corporation | --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.419 / Virus Database: 235 - Release Date: 11/13/2002 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
WebLogic Repository Selector Question
Has anyone tried the CRS in Ceki's containers document for WebLogic? I've put that CRS class in a WebLogic startup class. In my EJB.ejbCreate(), I have a statement like: Logger logger = Logger.getLogger(StateEJB.class); When ejbCreate() is called, I see the public LoggerRepository getLoggerRepository() { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Hierarchy hierarchy = (Hierarchy) ht.get(cl); if(hierarchy == null) { hierarchy = new Hierarchy(new RootCategory((Level) Level.DEBUG)); ht.put(cl, hierarchy); } return hierarchy; } method getting called but I get a complaint from log4j saying there are no appenders could be found for that logger and yet I see that logger in my log4j.xml configuration file. It's like that logger could not be found in my repository? any ideas? ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
log4j.dtd not found ?
I have a weblogic 7 application making extensive use of Log4j (1.2.6). I am attempting to convert the configuration properties file over to XML I have done this and it works, including finding the log4j.dtd. however during initialization I still get the message log4j:ERROR Could not find [log4j.dtd]. Used [sun.misc.Launcher$AppClassLoader@2c3c08] class loader in the search. I know some part of the initialization is finding it because my configuration is set up and runs correctly. Does anyone know where it is expecting to find this second copy of log4j.dtd, and if/why two separate location are necessary. I have tried all the usual/obvious places I think. Thanks Clive Beavis 650 464 2604 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: WebLogic Repository Selector Question
Hello David, Try the one I implemented. I works in Tomcat, but must exist in the the same classloader as the log4j.jar. In Tomcat, that means either in common/lib or shared/lib. Both can see each other so log4j.jar could be in common/lib and the jar containing Log4jCRS can be in either common/lib or shared/lib. Alternatviely, you can put a copy of log4j.jar in WEB-INF/lib. In that case, you need to make sure you also put the jar containing Log4jCRS in WEB-INF/lib as well. However, that doesn't really provide anything you don't already get by using log4j.jar in WEB-INF/lib anyway since that already provides a private environment for using Log4j for you app. Now, the other thing that needs to happen is that the classes using Log4jCRS *must* be loaded from the WebappClassloader. So, my Log4jInit servlet and Log4jApplicationWatch servlet context listener need to be inside a jar file in WEB-INF/lib. Here is Log4jCRS: http://barracuda.enhydra.org/software/cvs/cvsweb.cgi/Projects/EnhydraOrg/toolsTech/Barracuda/src/org/enhydra/barracuda/log4j/ Here are Log4jInit and Log4jApplicationWatch http://barracuda.enhydra.org/software/cvs/cvsweb.cgi/Projects/EnhydraOrg/toolsTech/Barracuda/src/org/enhydra/barracuda/webapp/log4j/ Also, you can see what the configuration for log4j looks like in the web.xml and log4j.xml here: http://barracuda.enhydra.org/software/cvs/cvsweb.cgi/Projects/EnhydraOrg/toolsTech/Barracuda/WEB-INF/ Now, keep in mind that the logger repositories created via Log4jCRS are keyed on the classloader. This means that when you do your configuration for each application, that application must be running in a separate classloader. I'm not sure exactly how that would work in an EJB container...but that is just because I haven't really written any EJB apps. Hopefully this helps with figuring out your issue. If nothing else, you can certainly use it for your webapps. Jake Wednesday, November 20, 2002, 3:21:02 PM, you wrote: LD Has anyone tried the CRS in Ceki's containers document for WebLogic? LD I've put that CRS class in a WebLogic startup class. LD In my EJB.ejbCreate(), I have a statement like: LD Logger logger = Logger.getLogger(StateEJB.class); LD When ejbCreate() is called, I see the LD public LoggerRepository getLoggerRepository() { LD ClassLoader cl = Thread.currentThread().getContextClassLoader(); LD Hierarchy hierarchy = (Hierarchy) ht.get(cl); LD if(hierarchy == null) { LD hierarchy = new Hierarchy(new RootCategory((Level) Level.DEBUG)); LD ht.put(cl, hierarchy); LD } LD return hierarchy; LD } LD method getting called but I get a complaint from log4j saying there are no LD appenders could be found for that logger and yet I see that logger in my LD log4j.xml configuration file. LD It's like that logger could not be found in my repository? LD any ideas? LD ** LD This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please LD contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, LD is strictly prohibited. LD TIAA-CREF LD ** LD -- LD To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] LD For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Best regards, Jacobmailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Updated version of the complete manual
Greetings to all, An updated version of the Complete log4j Manual just came out. This version completes chapters 6, 7 and 8 that were left blank in earlier versions. The manual is still a non-final draft. You can expect the book to be finalized during the month of December or early 2003. In any case, if you purchase it today, you will be entitled to the final version when it comes out. To obtain a copy go to http://jakarta.apache.org/log4j/docs/documentation.html and click on the image with the feathered dinosaur. -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
OutOfMemoryError using Log4J
Hi, We're using Log4J and we are trying to re initialize Log4J after a user has made some configuration changes. More to the point, we want to be able to change the log priority so we can turn on debug tracing without restarting our program. We are able to turn Debugging to so lesser priority (like ERROR or FATAL), but when we go the other way we get an OutOfMemoryException when we make the call: PropertyConfigurator.configure(props); Please help. We can't really seem to debug this since the stacktrace is blank. Is there something we need to call in addition to this call? Do we have to use the file monitoring stuff? charlie __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: WebLogic Repository Selector Question
Thanks for your reply, Jacob. I want to use log4j in a WebLogic environment with both EJBs and servlets. I also want to have this separation of logging so that if I have common components residing in many applications, those common components can be configured in one application without affecting the same common component in another application. I have used your Barracuda CRS and my approach is as follows: Put your CRS onto the system CP and have a Weblogic Startup class set that CRS as the logger repository to be used for the entire VM (WebLogic server). Put a ServletContextListener that will do a DOMConfigure() in each EAR and WAR file. I also happen to have a Servlet that will do a DOMConfigure() in its doPost() to dynamically reconfigure logging. This servlet is also in the EAR and WAR files. As my WebLogic server boots up, I can see that log4j is being initialized separately for each EAR and WAR file. That was encouraging since it led me to believe that the CRS was initializing a separate repository for each application (CL). However, after putting log4j statements in my EJBs, log4j complained that there were no appenders defined for loggers that were definitely defined in my log4j.xml. This suggested to me that even though there were separate repositories, the repository for my EJBs was not initialized with the loggers in my configuration file. As I thought about it more (with my poor knowledge of classloaders), this seems to make sense and would probably preclude using the CRS approach for EJBs (at least in WebLogic). My ServletContextListener lives in a Web Application classloader. Therefore, it's hierarchy is keyed in the CRS by its own CL. From my understanding, in WebLogic there is a separate CL for EJBs and servlets, with the former visible to the latter but not vice versa. Since there are two separate CLs, there will be separate hierarchies, one for EJBs and one for servlets. Since it was the servlet (listener) that initialized log4j, the key for that hierarchy will be the servlet classloader. The EJB, since it has its own CL, will have a separate repository that knows nothing about what the servlet did. In a past posting, Ceki said that using a servlet to initialize EJBs works. Nothing was said about using a custom repository selector. I assume that he made that statement assuming that I would keep one hierarchy for all applications instead of one hierarchy per application. Does this make sense to you? This would be a major blow to my strategy since my only other option is to place log4j.jar in each WAR/EAR file and *hope* administrators do not put a copy in the system CP. DAvid -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 5:12 PM To: Log4J Users List Subject: Re: WebLogic Repository Selector Question Hello David, Try the one I implemented. I works in Tomcat, but must exist in the the same classloader as the log4j.jar. In Tomcat, that means either in common/lib or shared/lib. Both can see each other so log4j.jar could be in common/lib and the jar containing Log4jCRS can be in either common/lib or shared/lib. Alternatviely, you can put a copy of log4j.jar in WEB-INF/lib. In that case, you need to make sure you also put the jar containing Log4jCRS in WEB-INF/lib as well. However, that doesn't really provide anything you don't already get by using log4j.jar in WEB-INF/lib anyway since that already provides a private environment for using Log4j for you app. Now, the other thing that needs to happen is that the classes using Log4jCRS *must* be loaded from the WebappClassloader. So, my Log4jInit servlet and Log4jApplicationWatch servlet context listener need to be inside a jar file in WEB-INF/lib. Here is Log4jCRS: http://barracuda.enhydra.org/software/cvs/cvsweb.cgi/Projects/EnhydraOrg/too lsTech/Barracuda/src/org/enhydra/barracuda/log4j/ Here are Log4jInit and Log4jApplicationWatch http://barracuda.enhydra.org/software/cvs/cvsweb.cgi/Projects/EnhydraOrg/too lsTech/Barracuda/src/org/enhydra/barracuda/webapp/log4j/ Also, you can see what the configuration for log4j looks like in the web.xml and log4j.xml here: http://barracuda.enhydra.org/software/cvs/cvsweb.cgi/Projects/EnhydraOrg/too lsTech/Barracuda/WEB-INF/ Now, keep in mind that the logger repositories created via Log4jCRS are keyed on the classloader. This means that when you do your configuration for each application, that application must be running in a separate classloader. I'm not sure exactly how that would work in an EJB container...but that is just because I haven't really written any EJB apps. Hopefully this helps with figuring out your issue. If nothing else, you can certainly use it for your webapps. Jake Wednesday, November 20, 2002, 3:21:02 PM, you wrote: LD Has anyone tried the CRS in Ceki's containers document for WebLogic? LD I've put that CRS class in a WebLogic startup class. LD In my EJB.ejbCreate(), I have a
RE: WebLogic Repository Selector Question
Unfortunately, I can tell you very little about either Weblogic or logging in EJB's because, like I said before, I haven't really written any J2EE apps. The one thing that should hold true is that you shouldn't need to worry about log4j being in the system classpath if you put a copy of log4j in each webapp's WEB-INF/lib directory because, unlike other classloading schemes, the way webapps work is that they look to their own classloader first before looking to other classloader to load libraries. This works to your advantage because then log4j will be loaded by each WebappClassloader instead of all apps looking at the one specified on the sysystem classpath. At least that is the way it works in Tomcat, but I believe the servlet spec requires that behavior. As as far as EJB's go, I'm not sure what to do there? There must be others on this list who have used log4j in EJB's and probably a few who have used log4j from within Weblogic. Maybe they can share their experiences. So, I think your webapps are all set, but for EJB's you may have to modify Log4jCRS or think of something else that you might want to key the different logger repositories on. Let me know if you find anything or improve up on my code. I'd love to figure all this out as well. Jake At 08:27 PM 11/20/2002 -0500, you wrote: Thanks for your reply, Jacob. I want to use log4j in a WebLogic environment with both EJBs and servlets. I also want to have this separation of logging so that if I have common components residing in many applications, those common components can be configured in one application without affecting the same common component in another application. I have used your Barracuda CRS and my approach is as follows: Put your CRS onto the system CP and have a Weblogic Startup class set that CRS as the logger repository to be used for the entire VM (WebLogic server). Put a ServletContextListener that will do a DOMConfigure() in each EAR and WAR file. I also happen to have a Servlet that will do a DOMConfigure() in its doPost() to dynamically reconfigure logging. This servlet is also in the EAR and WAR files. As my WebLogic server boots up, I can see that log4j is being initialized separately for each EAR and WAR file. That was encouraging since it led me to believe that the CRS was initializing a separate repository for each application (CL). However, after putting log4j statements in my EJBs, log4j complained that there were no appenders defined for loggers that were definitely defined in my log4j.xml. This suggested to me that even though there were separate repositories, the repository for my EJBs was not initialized with the loggers in my configuration file. As I thought about it more (with my poor knowledge of classloaders), this seems to make sense and would probably preclude using the CRS approach for EJBs (at least in WebLogic). My ServletContextListener lives in a Web Application classloader. Therefore, it's hierarchy is keyed in the CRS by its own CL. From my understanding, in WebLogic there is a separate CL for EJBs and servlets, with the former visible to the latter but not vice versa. Since there are two separate CLs, there will be separate hierarchies, one for EJBs and one for servlets. Since it was the servlet (listener) that initialized log4j, the key for that hierarchy will be the servlet classloader. The EJB, since it has its own CL, will have a separate repository that knows nothing about what the servlet did. In a past posting, Ceki said that using a servlet to initialize EJBs works. Nothing was said about using a custom repository selector. I assume that he made that statement assuming that I would keep one hierarchy for all applications instead of one hierarchy per application. Does this make sense to you? This would be a major blow to my strategy since my only other option is to place log4j.jar in each WAR/EAR file and *hope* administrators do not put a copy in the system CP. DAvid -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 20, 2002 5:12 PM To: Log4J Users List Subject: Re: WebLogic Repository Selector Question Hello David, Try the one I implemented. I works in Tomcat, but must exist in the the same classloader as the log4j.jar. In Tomcat, that means either in common/lib or shared/lib. Both can see each other so log4j.jar could be in common/lib and the jar containing Log4jCRS can be in either common/lib or shared/lib. Alternatviely, you can put a copy of log4j.jar in WEB-INF/lib. In that case, you need to make sure you also put the jar containing Log4jCRS in WEB-INF/lib as well. However, that doesn't really provide anything you don't already get by using log4j.jar in WEB-INF/lib anyway since that already provides a private environment for using Log4j for you app. Now, the other thing that needs to happen is that the classes using Log4jCRS *must* be loaded from the WebappClassloader. So, my Log4jInit