(Finally) Migrating from log4j 1.x
Christopher Schultz <[email protected]>
| Newsgroups | gmane.comp.jakarta.log4j.user |
|---|---|
| Message-ID | <[email protected]> |
All, My understanding is that under many circumstances, migrating from log4j 1.x -> 2.x is nearly as easy as simply upgrading the JAR file (and using the migration bridge library), but there are some other restrictions as noted here: https://logging.apache.org/log4j/2.x/manual/migration.html In various programs and services, we are using log4j 1.x in a way that might be a little hacky. Specifically, we have a set of classes which allow appenders and loggers to be reconfigured at runtime using calls such as Appender(Skeleton).setThreshold. Is there a way to do this kind of thing in log4j 2.x? We are also doing things like starting up with a hard-coded configuration to print-to-console and then, after loading a configuration from elsewhere (which may fail, hence logging to the console), re-initialing the logging system, with the new setup (e.g. log to file, network, etc.). The migration guide seems to say "you can't do this", but I think there reality may be "you can't do it anymore.... in the same way". Can I get some practical tips for upgrading from log4j 1.x -> 2.x given the desire to do some of the things listed above? Thanks, -chris