You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Mauro Talevi <ma...@aquilonia.org> on 2003/05/26 11:04:55 UTC
[Patch] Accessing logTargets in LogKitLoggerManager
Hello,
in order to implement the closure of logTargets
(see http://jira.codehaus.org/secure/ViewIssue.jspa?key=PNIX-9)
I've added functionality to cache and get LogTargets in the
LogKitLoggerManager.
Changes is required by the deprecation of the getLogTargets() method
in o.a.log.Logger, and is fully backward compatible.
If there are no objections, I'd appreciate if this patch could be
applied and a new minor release could be made (say 1.0.2)
Cheers, Mauro
===================================================================
RCS file:
/home/cvspublic/avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/LogKitLoggerManager.java,v
retrieving revision 1.14
diff -r1.14 LogKitLoggerManager.java
84a85,87
> /** Map for name to logTarget mapping */
> final private Map m_logTargets = new HashMap();
>
200a204,233
> /**
> * Retrieves the LogTargets for a given a category name.
> *
> * @param categoryName The category name of a configured Logger.
> * @return the LogTargets.
> */
> public final LogTarget[] getLogTargets( final String categoryName )
> {
> final String fullCategoryName = getFullCategoryName(
m_prefix, categoryName );
>
> final LogTarget[] logTargets = (LogTarget[])m_logTargets.get(
fullCategoryName );
>
> if( null != logTargets )
> {
> if( m_logger.isDebugEnabled() )
> {
> m_logger.debug( "LogTargets for category " +
fullCategoryName
+ " returned." );
> }
> return logTargets;
> }
>
> if( m_logger.isDebugEnabled() )
> {
> m_logger.debug( "LogTargets for category " +
fullCategoryName + "
not defined in "
> + "configuration." );
> }
> return new LogTarget[]{};
>
> }
>
240c273
<
---
>
368a402
> m_logTargets.put( fullCategory, logTargets );
Re: [Patch] Accessing logTargets in LogKitLoggerManager
Posted by Mauro Talevi <ma...@aquilonia.org>.
Peter Donald wrote:
>
> Rather than apply this patch directly I made the class implement Disposable
> and then made dispose close all the Closable log targets. This should work
> just aswell I think?
yep - actually a better solution. I was trying to minimise impact on
the API and thought that a getter method was less intrusive than
implementing a lifecycle method. But shutdown/dispose is much more in
line with the other logger managers (log4j and JDK14).
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Patch] Accessing logTargets in LogKitLoggerManager
Posted by Peter Donald <pe...@realityforge.org>.
On Mon, 26 May 2003 07:04 pm, Mauro Talevi wrote:
> Hello,
>
> in order to implement the closure of logTargets
> (see http://jira.codehaus.org/secure/ViewIssue.jspa?key=PNIX-9)
> I've added functionality to cache and get LogTargets in the
> LogKitLoggerManager.
>
> Changes is required by the deprecation of the getLogTargets() method
> in o.a.log.Logger, and is fully backward compatible.
>
> If there are no objections, I'd appreciate if this patch could be
> applied and a new minor release could be made (say 1.0.2)
Rather than apply this patch directly I made the class implement Disposable
and then made dispose close all the Closable log targets. This should work
just aswell I think?
--
Cheers,
Peter Donald
*-------------------------------------------*
| "A handful of sand is an anthology of the |
| universe." -Albert Einstein |
*-------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org