You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Asif Mekrani <as...@gmail.com> on 2007/03/07 13:36:27 UTC
named logger .
Hi Group,
Please can you tell me how to use the names logger. means :
Usually we use a class name for the logger name, eg:
private static Log logger = LogFactory.getLog(MyClass.class);
but wat if, I want to use a string name instead of the class name , i.e.
private static Log logger = LogFactory.getLog("MY_LOGGER_NAME");
and how to specify the same in the log4J.xml file.
TIA.
Smiles,
Asif
Re: named logger .
Posted by James Stauffer <st...@gmail.com>.
> private static Log logger = LogFactory.getLog(MyClass.class);
That will produce a logger named after the fully qualified name of the
class (i.e. "com.acme.project.MyClass")
> private static Log logger = LogFactory.getLog("MY_LOGGER_NAME");
That will produce a logger named exactly "MY_LOGGER_NAME"
> and how to specify the same in the log4J.xml file.
Examples:
<logger name="com.acme.project.MyClass">
<logger name="MY_LOGGER_NAME">
On 3/7/07, Asif Mekrani <as...@gmail.com> wrote:
> Hi Group,
>
> Please can you tell me how to use the names logger. means :
>
> Usually we use a class name for the logger name, eg:
>
> private static Log logger = LogFactory.getLog(MyClass.class);
>
> but wat if, I want to use a string name instead of the class name , i.e.
>
> private static Log logger = LogFactory.getLog("MY_LOGGER_NAME");
>
> and how to specify the same in the log4J.xml file.
>
> TIA.
>
> Smiles,
> Asif
>
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: named logger .
Posted by Asif Mekrani <as...@gmail.com>.
Thanks a lot Guys,
Smiles,
Asif
On 3/7/07, Jacob Kjome <ho...@visi.com> wrote:
>
> Quoting Asif Mekrani <as...@gmail.com>:
>
> > Hi Group,
> >
> > Please can you tell me how to use the names logger. means :
> >
> > Usually we use a class name for the logger name, eg:
> >
> > private static Log logger = LogFactory.getLog(MyClass.class);
> >
> > but wat if, I want to use a string name instead of the class name , i.e.
> >
> > private static Log logger = LogFactory.getLog("MY_LOGGER_NAME");
> >
> > and how to specify the same in the log4J.xml file.
> >
>
> <logger name="MY_LOGGER_NAME">
> ...
> </logger>
>
>
> Jake
>
> > TIA.
> >
> > Smiles,
> > Asif
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
Re: named logger .
Posted by Jacob Kjome <ho...@visi.com>.
Quoting Asif Mekrani <as...@gmail.com>:
> Hi Group,
>
> Please can you tell me how to use the names logger. means :
>
> Usually we use a class name for the logger name, eg:
>
> private static Log logger = LogFactory.getLog(MyClass.class);
>
> but wat if, I want to use a string name instead of the class name , i.e.
>
> private static Log logger = LogFactory.getLog("MY_LOGGER_NAME");
>
> and how to specify the same in the log4J.xml file.
>
<logger name="MY_LOGGER_NAME">
...
</logger>
Jake
> TIA.
>
> Smiles,
> Asif
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org