You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Krzysztof Szewczyk (JIRA)" <ji...@apache.org> on 2014/08/07 14:21:13 UTC

[jira] [Updated] (LOG4J2-770) Add method addOnLogging() in Logger interface

     [ https://issues.apache.org/jira/browse/LOG4J2-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Krzysztof Szewczyk updated LOG4J2-770:
--------------------------------------

    Summary: Add method addOnLogging() in Logger interface  (was: All method addOnLogging() in Logger interface)

> Add method addOnLogging() in Logger interface
> ---------------------------------------------
>
>                 Key: LOG4J2-770
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-770
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: API, Core
>            Reporter: Krzysztof Szewczyk
>
> It would be useful to add method addOnLogging or similar that would be enable the addition action during logging.
> In my work copy I did something like that:
> - I created:
>   >>public interface OnLogging{ public void onLogging(Level level, Object message, Throwable ex); }<<
> - I added to interface Logger method:
>   >>public void addOnLogging(OnLogging ol);<<
> - in Logger implementations I added:
>   >>private List<OnLogging> onLoggingList;<<,
>   implemented:
>   >>public addOnLogging(OnLogging ol){ onLoggingList.add(ol); }<<
>   and on method:
>   >>public void logMessage(final String fqcn, final Level level, final Marker marker, final Message msg, final Throwable throwable)<<
>    I added:
>   >>for(OnLogging ol : onLoggingList) { ol.onLogging(level, msg, t); }<<
> I needed it because I wanted to bind logs with my gui - on logging action I update some control to give user some information.
> I hope that you will consider it a useful feature



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org