Quoting Fabrizio Squittieri <[EMAIL PROTECTED]>: > Well, i can i say if i've got or not multiple log4j instances on a shared > server? > I've put log4j jar under JRE lib/ext so i presumed anyone would have to use > this and only this log4j instance, as is i've got a tomcat under which > several webapps are running and i've a bunch of standalone (batches) java > apps running at specified times. > How can i force anyone to share the very same instance of log4j in order to > avoid this behavoiur? >
The problem is two VM's trying to roll one logging file. The single "instance" log4j.jar in lib/ext is different from "instance" as it pertains to runtime instances. Each JVM will have an instance of Log4j. If each of these Log4j instances use the same Log4j config file which points to the same logging file to do appending and/or rolling, you will run into problems. It shouldn't be an issue within the same VM using the same instance of Log4j (actually, "instance" could be further defined as Log4j instance per classloader, assuming Log4j is being used in 2 classloaders in the same JVM where neither can see each other. I think you'd have the same problem). The file handle issue that Curt mentions could happen in the case where one instance of Log4j is running in a JVM and the classloader for the instance is restarted, such as in a webapp, without restarting the server. It is necessary that LogManager.shutdown() be called before the classloader is stopped in order for file handles to be released. If the file handles are not released, you'll get the same problematic behavior as previously described for Log4j in 2 JVM's accessing the same log file. Jake > > -----Messaggio originale----- > Da: Curt Arnold [mailto:[EMAIL PROTECTED] > Inviato: mercoled� 8 giugno 2005 19.47 > A: Log4J Users List > Oggetto: Re: R: DailyRollingFileAppender rolls but... > > I assume that you are running on a Unix or variant and not a Windows box. > The behavior is consistent with the appenders opening on the existing file, > the rename occurring but the appenders continuing to > write the old file handles. Might happen if you have independent > instances of log4j. > > > > On Jun 8, 2005, at 3:09 AM, Fabrizio Squittieri wrote: > > > > Not exactly sorry, > > On 6/07 when it restarts it makes log.txt.07062005 and writes to this > > and DO NOT writes on log.txt Sorry for my english... > > FS > > -----Messaggio originale----- > > Da: James Stauffer [mailto:[EMAIL PROTECTED] > > Inviato: marted� 7 giugno 2005 15.41 > > A: Log4J Users List > > Oggetto: Re: DailyRollingFileAppender rolls but... > > > > Is the following what are your trying to say? > > > > On 6/07 when it restarts it makes log.txt.07062005 but still writes > > logs to log.txt. > > > > On 6/7/05, Fabrizio Squittieri <[EMAIL PROTECTED]> wrote: > > > > > >> Hi there, > >> I'm reporting a weird thing: > >> every morning the server on which i've got log4j (v1.2.8) installed > >> reboot at 7.22 AM. > >> Now, when it boots up again, Tomcat comes up and log4j rolls log.txt > >> to log.txt.DDMMYYYY correctly but up to the next Tomcat restart every > >> application still log on the rolled file and not on the new one, and > >> i loose log statements of yesterday. > >> I hope someone could help me... > >> Thanks > >> > >> Fabrizio Squittieri - Programmatore > >> > >> Sistema informativo - Comune di Prato Via Cairoli 16 - Prato > >> [EMAIL PROTECTED] > >> > >> > >> > >> > >> > >> > >> > >> > > > > > > -- > > James Stauffer > > Are you good? Take the test at http://www.livingwaters.com/good/ > > > > --------------------------------------------------------------------- > > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
