logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krzysztof Szewczyk (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LOG4J2-770) Add method addOnLogging() in Logger interface
Date Thu, 07 Aug 2014 12:38:11 GMT

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

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

    Description: 
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:
{code:title=OnLogging.java|borderStyle=solid}
public interface OnLogging{
    public void onLogging(Level level, Object message, Throwable ex);
}
{code}
- I added to interface Logger method:
{code:title=org.apache.logging.log4j.core.Logger.java|borderStyle=solid}
public void addOnLogging(OnLogging ol);
{code}
- in Logger implementations I added:
{code:title=org.apache.logging.log4j.Logger.java|borderStyle=solid}
private List<OnLogging> onLoggingList;

public addOnLogging(OnLogging ol){
    onLoggingList.add(ol);
}

//edit method
public void logMessage(final String fqcn, final Level level, final Marker marker, final Message
msg, final Throwable throwable) {
// ....
    for(OnLogging ol : onLoggingList) {
        ol.onLogging(level, msg, t);
    }
}
{code}

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

  was:
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


> 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:
> {code:title=OnLogging.java|borderStyle=solid}
> public interface OnLogging{
>     public void onLogging(Level level, Object message, Throwable ex);
> }
> {code}
> - I added to interface Logger method:
> {code:title=org.apache.logging.log4j.core.Logger.java|borderStyle=solid}
> public void addOnLogging(OnLogging ol);
> {code}
> - in Logger implementations I added:
> {code:title=org.apache.logging.log4j.Logger.java|borderStyle=solid}
> private List<OnLogging> onLoggingList;
> public addOnLogging(OnLogging ol){
>     onLoggingList.add(ol);
> }
> //edit method
> public void logMessage(final String fqcn, final Level level, final Marker marker, final
Message msg, final Throwable throwable) {
> // ....
>     for(OnLogging ol : onLoggingList) {
>         ol.onLogging(level, msg, t);
>     }
> }
> {code}
> 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


Mime
View raw message