You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Viral_Thakkar <Vi...@infosys.com> on 2004/07/12 08:03:20 UTC
logging
Hi All,
I am using commons-logging (using log4j) for logging..
We do following logging style...
if (logger.isDebugEnabled())
{
logger.debug("Method Name : + some Message");
}
Here can we get the method name using java reflection or some other way
so that no need to pass the method name while logging the message ..???
Regards,
Viral
Re: logging
Posted by Shinobu Kawai <sh...@ieee.org>.
Hi Ravi,
> No ..no...its not an issue at all.
>
> Use it the way "Apurva" has mentioned.
>
> It works !!
Yes, that would be one solution. I am providing another solution.
It's just a matter of HOW. Which solution to pick is up to Viral.
As for me, the main reason to use commons-logging is to decouple my
application from the logging framework. Putting that in mind, Apurva's
solution is far from my philosophy.
BTW, Viral, you can just add a "%M" to your ConversionPattern and it
will be replaced by the method name! But be sure to read the comment on
http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html
about performance issues.
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: logging
Posted by Ravi Vedala <rv...@upromise.com>.
No ..no...its not an issue at all.
Use it the way "Apurva" has mentioned.
It works !!
Regds
R-a-v-i
-----Original Message-----
From: Shinobu Kawai [mailto:shinobu@ieee.org]
Sent: Monday, July 12, 2004 11:53 AM
To: Struts Users Mailing List
Subject: Re: logging
Hi Viral,
> I am using commons-logging (using log4j) for logging..
>
> We do following logging style...
>
> if (logger.isDebugEnabled())
> {
> logger.debug("Method Name : + some Message");
> }
>
> Here can we get the method name using java reflection or some other
> way so that no need to pass the method name while logging the message
> ..???
I believe this is a log4j issue.
Take a look at
http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.
html
and you should see "some other way". ;)
Good luck!
-- Shinobu Kawai
--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: logging
Posted by Shinobu Kawai <sh...@ieee.org>.
Hi Viral,
> I am using commons-logging (using log4j) for logging..
>
> We do following logging style...
>
> if (logger.isDebugEnabled())
> {
> logger.debug("Method Name : + some Message");
> }
>
> Here can we get the method name using java reflection or some other way
> so that no need to pass the method name while logging the message ..???
I believe this is a log4j issue.
Take a look at
http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html
and you should see "some other way". ;)
Good luck!
-- Shinobu Kawai
--
Shinobu Kawai <shinobu@ieee.org, shinobu@computer.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org