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

Alexey Kuznetsov updated IGNITE-8570:
-------------------------------------
    Description: 
Most usages of {{GridStringLogger}} in test assumes the following scenario. 
First, it is set as a logger for some Ignite node. Then, after some activity on 
that node, log content is searched for some predefined strings. 
{{GridStringLogger}} uses {{StringBuilder}} of bounded size internally to store 
log contents, older contents gets dropped on exaustion. Thus, changes that add 
more logging may damage some independent tests that use {{GridStringLogger}}.

The suggestion is to implement and use another test logger conforming to these 
requirements:
* It does not accumulate any logs.
* It allows to set the listener that fires when log message matches certain 
regular expression, {{Matcher}} can be passed to the listener.

Proposed design, pseudocode:

```
Class GridRegexpLogger implements IgniteLogger{
…
debug(String str){
if(/* str matches pattern. */{
                                /* notify listeners. */
        }
}
…
listen("regexp", loggerListener){
        /* registers listener. */
}

listenDebug("regexp", loggerListener){
        /* registers listener for debug output only. */
}
…

waitFor("regexp", timeout){
        /* like GridTestUtils.waitForCondition(), waits for regexp to occure in 
logs. */
}
…
}
```

Sample regexp logger usage:

```
GridRegexpLogger logger;
 
logger.listen(“regexp”, new GridRegexpListener());
logger.waitFor("regexp", 100);
```

  was:
Most usages of {{GridStringLogger}} in test assumes the following scenario. 
First, it is set as a logger for some Ignite node. Then, after some activity on 
that node, log content is searched for some predefined strings. 
{{GridStringLogger}} uses {{StringBuilder}} of bounded size internally to store 
log contents, older contents gets dropped on exaustion. Thus, changes that add 
more logging may damage some independent tests that use {{GridStringLogger}}.

The suggestion is to implement and use another test logger conforming to these 
requirements:
* It does not accumulate any logs.
* It allows to set the listener that fires when log message matches certain 
regular expression, {{Matcher}} can be passed to the listener.


> Create lighter version of GridStringLogger
> ------------------------------------------
>
>                 Key: IGNITE-8570
>                 URL: https://issues.apache.org/jira/browse/IGNITE-8570
>             Project: Ignite
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Andrey Kuznetsov
>            Assignee: Alexey Kuznetsov
>            Priority: Major
>             Fix For: 2.6
>
>
> Most usages of {{GridStringLogger}} in test assumes the following scenario. 
> First, it is set as a logger for some Ignite node. Then, after some activity 
> on that node, log content is searched for some predefined strings. 
> {{GridStringLogger}} uses {{StringBuilder}} of bounded size internally to 
> store log contents, older contents gets dropped on exaustion. Thus, changes 
> that add more logging may damage some independent tests that use 
> {{GridStringLogger}}.
> The suggestion is to implement and use another test logger conforming to 
> these requirements:
> * It does not accumulate any logs.
> * It allows to set the listener that fires when log message matches certain 
> regular expression, {{Matcher}} can be passed to the listener.
> Proposed design, pseudocode:
> ```
> Class GridRegexpLogger implements IgniteLogger{
> …
> debug(String str){
> if(/* str matches pattern. */{
>                                 /* notify listeners. */
>       }
> }
> …
> listen("regexp", loggerListener){
>       /* registers listener. */
> }
> listenDebug("regexp", loggerListener){
>       /* registers listener for debug output only. */
> }
> …
> waitFor("regexp", timeout){
>       /* like GridTestUtils.waitForCondition(), waits for regexp to occure in 
> logs. */
> }
> …
> }
> ```
> Sample regexp logger usage:
> ```
> GridRegexpLogger logger;
>  
> logger.listen(“regexp”, new GridRegexpListener());
> logger.waitFor("regexp", 100);
> ```



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to