Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 51894 invoked from network); 17 Sep 2006 20:19:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Sep 2006 20:19:39 -0000 Received: (qmail 35862 invoked by uid 500); 17 Sep 2006 20:19:37 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 35825 invoked by uid 500); 17 Sep 2006 20:19:36 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 35808 invoked by uid 99); 17 Sep 2006 20:19:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Sep 2006 13:19:36 -0700 X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=INFO_TLD X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [68.142.225.206] (HELO smtp108.rog.mail.re2.yahoo.com) (68.142.225.206) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 17 Sep 2006 13:19:24 -0700 Received: (qmail 75521 invoked from network); 17 Sep 2006 20:18:56 -0000 Received: from unknown (HELO ?192.168.1.102?) (mansour77@rogers.com@74.106.173.165 with plain) by smtp108.rog.mail.re2.yahoo.com with SMTP; 17 Sep 2006 20:18:56 -0000 Message-ID: <450DADAF.6000003@ownmail.net> Date: Sun, 17 Sep 2006 17:18:55 -0300 From: Mansour User-Agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Log4J Users List Subject: Re: Logger.getRootLogger() ?? is't static with respect to the JVM ? References: <450C7DC0.1040706@ownmail.net> <7.0.1.0.0.20060917142427.00adfbf0@visi.com> In-Reply-To: <7.0.1.0.0.20060917142427.00adfbf0@visi.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Jacob: Here's what I have, 1- both applications are opend in totally different browsers. 2- in fact both applications are totally different, the applets are (Host.java , Controller.java). 3- the last assumption might be true about firefox providing one shared JVM throug the plugin. I will launch a search for this, and find out what's going on. I am not looking to expand my skills in log4j and use repository selector, as I need not to be confused about the basics. I am new to log4j as you know. May be in a later time, I will. From what I understand, is that my design for reusable component is correct. Again, I am creating a private logger in each class, and log to that logger, without configuring it. The configuration is taking place only in the application that uses this component, by configuring the rootLogger. So, in each class, I do this: Logger logger = Logger.getLogger(this.getClass()); logger.info("this is a component class"); In the application class: Logger logger = Logger.getLogger(this.getClass()); Logger.getRootLogger().addAppender(new FrameAppender(this,"Controller logs")); logger.setLevel(Level.ALL); BasicConfigurator.configure(); logger.info("this is the application class"); The heirerachy I am expecting is as follow: rootLogger / | \ comp1Logger mainLogger comp2Logger If that's correct then let me know please. I will let you know soon about the JVM issue. I am using Fedora 4 _64. FireFox and JRE are built for x86_32. I had to do this to get support for flash. I will see what I can do. Thanks Jacob Kjome wrote: > At 05:42 PM 9/16/2006, you wrote: > >Hello every body: > >I am having some difficulties working with log4j, and I need some help > >from some one. > >I am writing a client/server application, in some way it can be compared > >with a chat client, where two or more users connect to the server > >through an applet. > >Now the applets uses classes from packages I wrote. The classes logges > >messages to no where (no logger is configured in them) I left the > >configuration for the main class, so that I can reuse those classes > >elsewhere. I am using a simple appender that I wrote, to display the > >logs in a JFrame. > >The problem is I am getting the logs from each applet displayed in it's > >own log JFrame and in the other one!! > >I am testing this on my machine, now both chat programs (applets) > >connect to the server. The first one logs the messages to both Frames !! > >And the second one does the same. > > > >At the begining of each applet I used this: > >//******************************************** > >logger = Logger.getLogger(this.getClass()); > >Logger.getRootLogger().addAppender(new FrameAppender(this,"Controller > >logs")); > >logger.setLevel(Level.ALL); > >BasicConfigurator.configure(); > >//******************************************** > > > >from what I understand, Logger.getRootLogger() is a static method, > >therefore the logger returned by it ( Logger.getRootLogger() ) is > >static, but static means for each JVM. In other words, both applets run > >in a separate JVMs, and there should be nothing shared !!! > > > > Are you sure your expectation of a separate JVM for each applet is > valid? From my experience, when a Java Applet is first loaded, the JVM > starts up. If you go to another page, I'm pretty sure no other JVM is > started. The second applet simply uses the running JVM. And based on > the behavior you see, I think this is confirmed. A couple questions, > though... > > 1. Are the two separate instances of the chat applet started in the > same browser session or completely separate browsers such as Firefox > and IE? > 2. Are they, in fact, the same applet, or two different chat > applications talking to the same server? If the JVM doesn't normally > get shared across applets (which, again, may be an invalid > assumption), maybe it does if the applet instances are from the same > codebase? > 3. Is it possible that even with separate browsers, the Java Plugin > provides a single shared JVM environment across browsers? > > >Now, what ever was the reason, how do I get around this ??? Let's say My > >main class is called Chat.java , and it uses another class > CustomSocket.java > >What i would do in CustomSocket.java, is instantiate an object of Logger > >through Logger.getLogger(this.getClass()), and logs my messages > >normally. Then the application that uses CustomSocket has to configure > >the logger (apender, Level ,....etc). How do I achive this. Please note > >that I am only newbie, and I am not looking to use configuration files. > >Just doing very basic configuration. > >If you need any more info about this problem, just please let me know, I > >'ve included what I think is relevant. > > Interesting problem. Sounds like you need a repository selector that > selects on classloader or some other available criteria that can > provide differentiation between application instances. The problem is > that repository selectors must be set once and if the applet that sets > the selector is unloaded, the other applets will cease to log properly > and won't be able to reset the selector, since it is protected by a > guard object. > > Anyone else have idea's here? I haven't had to tackle this issue in an > applet environment, only a server environment where I have full > control of the server. > > Jake > > >Thank you. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > For additional commands, e-mail: log4j-user-help@logging.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org