Hi Jason,

On Sat, 3 Jun 2023 at 00:13, Jason Guild <jason.gu...@alaska.gov> wrote:
> The application currently uses log4j-web to get the all the essential
> setup for initializing log4j 2 under an application container. The
> log4j-web library appears to have a hard dependency on log4j-core.

The `log4j-web` module is only useful to initialize the `log4j-core`
implementation of the Log4j 2.x API. If you don't use `log4j-core` you
don't need it.



On Sat, 3 Jun 2023 at 02:23, Ralph Goers <ralph.go...@dslextreme.com> wrote:
>
> When using log4j-to-jul you cannot use ANY other log4j modules except for 
> log4j-api. You must configure Tomcat’s logging to handle all the logging for 
> your application.

That is a little bit oversimplified. There are a lot of Log4j modules:

 * some like `log4j-layout-template-json` or `log4j-web` contain
components for `log4j-core`. These can not be used with
`log4j-to-jul`.
 * other modules contain adapters from framework X to Log4j 2.x API
(e.g. `log4j-slf4j-impl`) or depend only on the Log4j 2.x API (e.g.
`log4j-iostreams`). These can be used with `log4j-to-jul`.

At work we use `log4j-api` + `log4j-to-jul` for all application
logging together with:

 * `log4j-slf4j-impl` (the dependency on `log4j-core` is just for the
comfort of most users and can be safely excluded), `log4j-jcl` and
`log4j-iostreams` to forward everything other logging framework to
Log4j 2.x API,
 * a `WEB-INF/classes/logging.properties` file that provides
per-application configuration (using the standard
ClassLoaderLogManager JUL implementation shipped with Tomcat). The
`${classloader.webappName}` variable comes very handy here.

Logging is not very important for our clients and this limits our
responsibility in case of problems with `log4j-core`.

Obviously this is hardly a useful setup during development and tests,
so our test machines use my Log4j extensions[1] to delegate all Log4j
2.x API calls to a `log4j-core` installation in Tomcat's system
classloader.

Piotr

[1] https://github.com/copernik-eu/log4j-plugins

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to