Re: [D] Help with migrating from log4j to log4j2 (we also use a slf4j -> log4j) [logging-log4j2]

paladox (via GitHub) <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.devel
Message-ID <ghd-D_kwDOAKJSSM4AhuMF-b0a0f28d-28bd-4317-a64d-1d7da1625a18__24806.5557958157$1757243847$gmane$org@gitbox.apache.org>
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 [email protected].
To unsubscribe, please send an email to: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.