Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 91771 invoked from network); 30 Aug 2007 14:42:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Aug 2007 14:42:29 -0000 Received: (qmail 72105 invoked by uid 500); 30 Aug 2007 14:42:19 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 72075 invoked by uid 500); 30 Aug 2007 14:42:19 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 72064 invoked by uid 99); 30 Aug 2007 14:42:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2007 07:42:19 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bernhard.huemer@gmail.com designates 64.233.182.185 as permitted sender) Received: from [64.233.182.185] (HELO nf-out-0910.google.com) (64.233.182.185) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2007 14:42:14 +0000 Received: by nf-out-0910.google.com with SMTP id b2so465098nfb for ; Thu, 30 Aug 2007 07:41:52 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=MUxUNd9E2mRmgJm5uYlXxaIaMQubM3FhpZRNMKkCfCEQ6SroDEizL/H9h5wuGHaooGFvpN93RMq4K8T+1xlUZUfbp6I/zPWTx+7+WoscOo98v6YDlS3B+G74Pe+SfbXJ64ENPYF0MevOsZNarBxruE1AdCcbVyQNzfJtWL6ro1g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=Bz9FiQOeFMoFLMoAMHMW6wuQU8qVOgwas0aetlbiNGXKovBKwM95LdK7Hzhs4/xm82esPhlCh/Qy3tWI22gl8Q2yeLBobtpNx74dFYLPzLWdM7bd/41OYS+Yt/ZKH/2p+7nfke+R4iWSPOuDDSL+u9AJUL00Q1YTFOqWNWgeXxs= Received: by 10.86.73.17 with SMTP id v17mr474519fga.1188484911514; Thu, 30 Aug 2007 07:41:51 -0700 (PDT) Received: from ?192.168.1.2? ( [62.47.39.226]) by mx.google.com with ESMTPS id a37sm1095649fkc.2007.08.30.07.41.46 (version=SSLv3 cipher=RC4-MD5); Thu, 30 Aug 2007 07:41:47 -0700 (PDT) Message-ID: <46D6D727.4090000@gmail.com> Date: Thu, 30 Aug 2007 16:41:43 +0200 From: Bernhard Huemer User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: MyFaces Discussion Subject: Re: Log each call to an JSF action method References: <45190510708290851l7ebb2bcfpfeceb772f606029b@mail.gmail.com> <45190510708291313q5f6e59c6j2e430f750d18cc2c@mail.gmail.com> In-Reply-To: <45190510708291313q5f6e59c6j2e430f750d18cc2c@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello, you could also use a custom ActionListener implementation if the method expression being processed is sufficient (for example, "Processing the action '#{actionBean.processAction}'."), as Andrew has already mentioned. /// import javax.faces.component.ActionSource; import javax.faces.event.AbortProcessingException; import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class LoggingActionListener implements ActionListener { private static final Log log = LogFactory.getLog(LoggingActionListener.class); private ActionListener delegate; public LoggingActionListener(ActionListener delegate) { this.delegate = delegate; } public void processAction(ActionEvent actionEvent) throws AbortProcessingException { if (log.isDebugEnabled()) { ActionSource actionSource = (ActionSource) actionEvent.getComponent(); log.debug("Processing the action '" + actionSource.getAction().getExpressionString() + "'."); } delegate.processAction(actionEvent); } } \\\ /// // faces-config.xml demo.LoggingActionListener \\\ regards, Bernhard Svilen Ivanov wrote: > Andrew, > > I think it is fine to wait for the action to end. However, if > NavigationHandlerImpl does it for me - all I have to do is to enable > the log. Thank you for your reply - I'll give it a shot. > > Regards, > Svilen > > 2007/8/29, Andrew Robinson : > >> If you can wait until after the action has been called, you can use >> the ActionListener of the JSF Application or the NavigationHandler as >> both have access to the action EL expression. BTW - the myfaces >> NavigationHandlerImpl already logs each call at debug level. >> >> -Andrew >> >> On 8/29/07, Svilen Ivanov wrote: >> >>> For audit and debugging purposes I want to log the name of action >>> method that is being called. Is it possible to hook somewhere in JSF >>> lifecycle? Or should I use Aspect oriented approach? >>> >>> Any ideas are appreciated? >>> >>> -- >>> Svilen Ivanov >>> http://svilen-online.blogspot.com >>> >>> There is no dark side of the moon really. >>> Matter of fact it's all dark. >>> >>> > > >