You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by vijay shanker <vi...@gmail.com> on 2009/12/11 07:07:32 UTC

how to change log label at the run time

Hi all

I am using commons-logging with aspectj.

Once I created a log object by below code

--------
private Log log = LogFactory.getLog(LoggingAspect.class);
--------

When i print log with this object; i get output like

--------
2009-12-11 11:31:41,558 INFO  [LoggingAspect] com.stpl.pocs.logs.BaseService
: Entering method getName.
2009-12-11 11:31:41,558 INFO  [LoggingAspect] com.stpl.pocs.logs.BaseService
: Exiting method getName.
--------

Is there any way I can change the " [LoggingAspect]" to the class name
 "com.stpl.pocs.logs.BaseService".

So this is requirement I presume is to change log label dynamically.

Please suggest.

Regards,
Vijay Shanker Dubey

Re: how to change log label at the run time

Posted by vijay shanker <vi...@gmail.com>.
You are right joerg.

I am doing so.

Thanks for the help. I will update here to my findings.

Regards,
Vijay Shanker Dubey


On Sun, Dec 13, 2009 at 12:22 AM, Jörg Schaible <jo...@gmx.de>wrote:

> Hi Vijay,
>
> vijay shanker wrote:
>
> > Hi joerg;
> >
> > I am using log4j as log4j as log implementation.
>
> This is fine.
>
> > Can you suggest any thing relevant to my situation and requirement
>
> Well, you will have to consult the Log4J documentation for this.
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: how to change log label at the run time

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Vijay,

vijay shanker wrote:

> Hi joerg;
> 
> I am using log4j as log4j as log implementation.

This is fine.
 
> Can you suggest any thing relevant to my situation and requirement

Well, you will have to consult the Log4J documentation for this.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: how to change log label at the run time

Posted by vijay shanker <vi...@gmail.com>.
Hi joerg;

I am using log4j as log4j as log implementation.

Can you suggest any thing relevant to my situation and requirement



Regards,
Vijay Shanker Dubey
Ph: +91-9818311884


2009/12/11 Jörg Schaible <jo...@gmx.de>

> Hi Vijay,
>
> vijay shanker wrote at Freitag, 11. Dezember 2009 07:07:
>
> > Hi all
> >
> > I am using commons-logging with aspectj.
> >
> > Once I created a log object by below code
> >
> > --------
> > private Log log = LogFactory.getLog(LoggingAspect.class);
> > --------
> >
> > When i print log with this object; i get output like
> >
> > --------
> > 2009-12-11 11:31:41,558 INFO  [LoggingAspect]
> > com.stpl.pocs.logs.BaseService
> > : Entering method getName.
> > 2009-12-11 11:31:41,558 INFO  [LoggingAspect]
> > com.stpl.pocs.logs.BaseService
> > : Exiting method getName.
> > --------
> >
> > Is there any way I can change the " [LoggingAspect]" to the class name
> >  "com.stpl.pocs.logs.BaseService".
> >
> > So this is requirement I presume is to change log label dynamically.
> >
> > Please suggest.
>
> Actually you cannot. Simply because commons-logging does not log ;-)
>
> See, commons-logging is only a bridge for various logging systems.
> Therefore
> you have to look into the documentation of the log implementation in use,
> how to configure the output. Looking at yours, the log seems to be handled
> by the JDK logger, so consult the JDK documentation for the logger
> configuration. Or select a logging implementation you're more familiar
> with:
> http://commons.apache.org/logging/commons-
> logging-1.1.1/guide.html#Configuration
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: how to change log label at the run time

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Vijay,

vijay shanker wrote at Freitag, 11. Dezember 2009 07:07:

> Hi all
> 
> I am using commons-logging with aspectj.
> 
> Once I created a log object by below code
> 
> --------
> private Log log = LogFactory.getLog(LoggingAspect.class);
> --------
> 
> When i print log with this object; i get output like
> 
> --------
> 2009-12-11 11:31:41,558 INFO  [LoggingAspect]
> com.stpl.pocs.logs.BaseService
> : Entering method getName.
> 2009-12-11 11:31:41,558 INFO  [LoggingAspect]
> com.stpl.pocs.logs.BaseService
> : Exiting method getName.
> --------
> 
> Is there any way I can change the " [LoggingAspect]" to the class name
>  "com.stpl.pocs.logs.BaseService".
> 
> So this is requirement I presume is to change log label dynamically.
> 
> Please suggest.

Actually you cannot. Simply because commons-logging does not log ;-)

See, commons-logging is only a bridge for various logging systems. Therefore 
you have to look into the documentation of the log implementation in use, 
how to configure the output. Looking at yours, the log seems to be handled 
by the JDK logger, so consult the JDK documentation for the logger 
configuration. Or select a logging implementation you're more familiar with: 
http://commons.apache.org/logging/commons-
logging-1.1.1/guide.html#Configuration

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org