GitHub user paladox added a comment to the discussion: Help with migrating from 
log4j to log4j2 (we also use a slf4j -> log4j)

Doing something like:

```
  private void appendSafe(Log4jLogEvent event) {
    synchronized (lock) {
      if (async != null && async.isStopped()) {
        async = null;
        enableLogging();
      }
      if (async != null) {
        async.append(event);
      }
    }
  }
```

and then changing onLogin (and the rest to use appendSafe) to:

```
  void onLogin() {
    LogEvent entry = log("LOGIN FROM " + 
session.get().getRemoteAddressAsString());
    appendSafe(entry);
    audit(context.get(), "0", "LOGIN");
  }
```

seems to have fixed it, but is this needed? or is there another way?

GitHub link: 
https://github.com/apache/logging-log4j2/discussions/3914#discussioncomment-14331208

----
This is an automatically sent email for dev@logging.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@logging.apache.org

Reply via email to