Return-Path: Delivered-To: apmail-jakarta-avalon-dev-archive@jakarta.apache.org Received: (qmail 25246 invoked by uid 500); 26 Jun 2001 04:42:55 -0000 Mailing-List: contact avalon-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: "Avalon Development" Delivered-To: mailing list avalon-dev@jakarta.apache.org Received: (qmail 25223 invoked from network); 26 Jun 2001 04:42:51 -0000 Reply-To: From: "Gautam Mani" To: "'Avalon Development'" Subject: RE: LogKit problems Date: Tue, 26 Jun 2001 10:16:31 +0530 Message-ID: <000601c0fdfa$f8ad1d40$a10000c8@gautampc> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 In-Reply-To: <01062613232707.00802@helm.realityforge.org> Importance: Normal X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Hi, Would it not make sense to put this into the tree; since a lot of people use it? Cheers, Gautam -- How can you have any pudding if you don't eat your meat? -- Pink Floyd > -----Original Message----- > From: Peter Donald [mailto:donaldp@apache.org] > Sent: Tuesday, June 26, 2001 8:53 AM > To: Avalon Development > Subject: Re: LogKit problems > > > On Tue, 26 Jun 2001 09:01, Mohit Dilawari wrote: > > I am trying to use LogKit and I am having a bit of > > trouble appending messages. > > > > I create a log file in a shell script and then I pass > > the location of the logfile to a java program. I > > would like LogKit to append debug messages to this > > file. > > > > Unfortunately, LogKit seems to delete the log file > > before it writes to the logfile. > > > > How do I append trace messages to a file that is > > already created from LogKit? > > > > The following is my code snippet: > > > > Logger logger = > > Hierarchy.getDefaultHierarchy().getLoggerFor("myCategory"); > > > > FileOutputLogTarget target = new > > FileOutputLogTarget("C:\\SOD\\code\\test\\output\\out1.txt"); > > target.setFormat( "%7.7{priority} %5.5{time} > > [%8.8{category}] " + > > "(%{context}): > > %{message}\\n%{throwable}" ); > > > > logger.setLogTargets( new LogTarget[] { target } ); > > > > > > logger.setPriority( Priority.DEBUG ); > > logger.debug( "This is a debug message" ); > > Thats the desired behaviour ;) Probably the best thing you > could do would be > to add a new LogTarget such as > > public class MyFileOutputLogTarget > extends DefaultOutputLogTarget > { > public void setFilename( final String filename ) > throws IOException > { > final File file = new File( filename ); > final File parent = file.getAbsoluteFile().getParentFile(); > if( !parent.exists() ) parent.mkdirs(); > > //Next line is different and tells system to append > m_output = new FileWriter( filename, true ); > } > } > > > Cheers, > > Pete > > *-----------------------------------------------------* > | "Faced with the choice between changing one's mind, | > | and proving that there is no need to do so - almost | > | everyone gets busy on the proof." | > | - John Kenneth Galbraith | > *-----------------------------------------------------* > > --------------------------------------------------------------------- > To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: avalon-dev-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: avalon-dev-help@jakarta.apache.org