Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 74354 invoked from network); 1 Jun 2009 15:37:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Jun 2009 15:37:42 -0000 Received: (qmail 70389 invoked by uid 500); 1 Jun 2009 15:37:54 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 70319 invoked by uid 500); 1 Jun 2009 15:37:53 -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 70308 invoked by uid 99); 1 Jun 2009 15:37:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2009 15:37:53 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of hoju@visi.com designates 208.42.176.221 as permitted sender) Received: from [208.42.176.221] (HELO g2host.com) (208.42.176.221) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2009 15:37:42 +0000 Received: from [162.136.193.1] (account hoju@visi.com) by mailback2.g2host.com (CommuniGate Pro WEBUSER 5.1.16) with HTTP id 14788604 for log4j-user@logging.apache.org; Mon, 01 Jun 2009 10:37:20 -0500 From: "Jacob Kjome" Subject: Re: Extract log info from each output log line on the console To: "Log4J Users List" X-Mailer: CommuniGate Pro WebUser v5.1.16 Date: Mon, 01 Jun 2009 10:37:20 -0500 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1;format="flowed" Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On Mon, 1 Jun 2009 08:32:38 -0400 Douglas E Wegscheid wrote: > if you have a chance to change the log file layout, use the XMLLayout. > It's unambiguous to parse. > XMLLayout is probably the most straightforward option.� Another option is the receiver companion's LogFilePatternReceiver, which Chainsaw2 makes use of.... http://svn.apache.org/viewvc/logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/varia/LogFilePatternReceiver.java?view=log See also... http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/vfs/ Jake > parsing the other layouts can be a problem (think about the situation of > messages spanning multiple lines, or that have an exception trackback...) > > Douglas E Wegscheid > Lead Technical Analyst, Whirlpool Corporation > (269)-923-5278 > > "A wrong note played hesitatingly is a wrong note. A wrong note played > with conviction is interpretation." > > > > > > gamby > 06/01/2009 07:00 AM > Please respond to > "Log4J Users List" > > > To > log4j-user@logging.apache.org > cc > > Subject > Extract log info from each output log line on the console > > > > > > > > Hi all, > > I'm developing a tool to do some auto statistics from the generated log of > an app... > > I would like to be able to parse each log line generated obviously with > lo4j > and extract all the info (timestamp, thread name, message and the others) > in > a way that I could process separately those info. > Obviuosly I assume to know the pattern used to produce a log, knowing that > pattern, I would like to extract all the info. > >For example if I know that a log file was produced using this pattern --> > %d > %-5p [%t] - %m%n > Then I would like to extract from the generated log line, the timestamp, > the > priority, the thread and the message, but without parsing the raw text > using > string indexes for example.... > > And so the flow should be: > - An application produces some log > - My component read each log line generated and extract all the info, > based > on log4j pattern used to produce that log > > Any hints? > Thanks in advance > Gamby > -- > View this message in context: > http://www.nabble.com/Extract-log-info-from-each-output-log-line-on-the-console-tp23813238p23813238.html > > Sent from the Log4j - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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