He means this:

public class OfflineMethodsDelegate extends BaseDelegate {

       private static Logger logger1 = Logger.getInstance("MyLogger1");

       private static Logger logger2 = Logger.getInstance("MyLogger2");



public void method1(UserInfo uInfo)throws DAOException {
               logger1.debug("This is Method 1 Log");

       }

public void method2(UserInfo uInfo)throws DAOException {
               logger2.debug("This is Method 2 Log");

       }

}


In the log4j file add different logger definitions for MyLogger1 and
MyLogger2.


On Thu, Apr 16, 2009 at 5:27 PM, Vani Bandargal <vanims...@hotmail.com>wrote:

>
> Matt, I am providing code based on what I understood from your suggestion.
>
> Do you mean to do this?
>
> public class OfflineMethodsDelegate extends BaseDelegate {
>        private static Logger logger1 =
> Logger.getInstance(OfflineMethodsDelegate.class);
>        private static Logger logger2 =
> Logger.getInstance(OfflineMethodsDelegate.class);
>
>
>
> public void method1(UserInfo uInfo)throws DAOException {
>                logger1.debug("This is Method 1 Log");
>
>        }
>
> public void method2(UserInfo uInfo)throws DAOException {
>                logger2.debug("This is Method 2 Log");
>
>        }
>
> }
>
>
>
> Vani Bandargal wrote:
> >
> > Thank you Matt.
> > Could you Please eloborate on what you are suggesting?
> >
> > Are you referring to name given in Logger.getLogger() method.
> >
> > I tried this. Is not it it is just a name of logger object and no  matter
> > you give 2 different names, it will write to the same log file configured
> > for that package.
> > Thanks for any tips
> >
>
> --
> View this message in context:
> http://www.nabble.com/Is-there-any-way-to-output-the-log-statemts-from-a-particular-method-to-a-different-log-file-other-than-what-is-configued-for-that-package--tp23078688p23079102.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>

Reply via email to