[ 
https://issues.apache.org/jira/browse/SOLR-12055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16595628#comment-16595628
 ] 

Erick Erickson commented on SOLR-12055:
---------------------------------------

What I _think_ I'm seeing is that there is a lag between sending a log message 
and it gets written. Which is only to be expected when we go to async. So the 
test failure goes away with the following hack (and no, I'm not suggesting this 
as a "fix").

 
{code:java}
@Test
public void eoe() {
LogWatcher watcher = LogWatcher.newRegisteredLogWatcher(config, null);

assertEquals(watcher.getLastEvent(), -1);

log.warn("This is a test message");
assertTrue(watcher.getLastEvent() > -1);

watcher = LogWatcher.newRegisteredLogWatcher(config, null);

assertEquals(watcher.getLastEvent(), -1);

log.warn("This is a test message");
long last = -1;
for (int idx = 0; last == -1 && idx < 10; ++idx) {
  last = watcher.getLastEvent();

  System.out.println("lastEvent: " + last);
}
assertTrue(watcher.getLastEvent() > -1);
}
{code}
After a few rounds, printing last changes from -1 to something > 1 and the test 
succeeds.

I've poked around briefly and don't see anything to insure that all sent 
messages have been recorded, nor anything to flush the queue. I'll keep digging 
but if anyone knows off the top of their head....

 Interestingly, sleeping fails (not that I like that solution either) and the 
first assert succeeds (although that may well be coincidence).

Digging....

 

> Enable async logging by default
> -------------------------------
>
>                 Key: SOLR-12055
>                 URL: https://issues.apache.org/jira/browse/SOLR-12055
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: logging
>            Reporter: Erick Erickson
>            Assignee: Erick Erickson
>            Priority: Minor
>         Attachments: SOLR-12055-slh-interim1.patch, 
> SOLR-12055-slh-interim1.patch
>
>
> When SOLR-7887 is done, switching to async logging will be a simple change to 
> the config files for log4j2. This will reduce contention and increase 
> throughput generally and logging in particular.
> There's a discussion of the pros/cons here: 
> https://logging.apache.org/log4j/2.0/manual/async.html
> An alternative is to put a note in the Ref Guide about how to enable async 
> logging.
> I guess even if we enable async by default the ref guide still needs a note 
> about how to _disable_ it.....



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to