Skip to content

Log4j's tag library doesn't work out of the box as log4j-*.jar is skipped by default #23302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wilkinsona opened this issue Sep 14, 2020 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

wilkinsona commented Sep 14, 2020

We originally tried to align with Tomcat. I had assumed that things had got out of sync, but Tomcat skips log4j*.jar by default so I don't think it'll work there either by default either.

@markt-asf, should Tomcat's default be updated so that log4j-taglib isn't skipped?

@wilkinsona wilkinsona added the type: bug A general bug label Sep 14, 2020
@wilkinsona wilkinsona added this to the 2.2.x milestone Sep 14, 2020
@wilkinsona
Copy link
Member Author

wilkinsona commented Sep 14, 2020

Scratch that. I see now why it works when deployed to a Tomcat installation. Tomcat overrides the skipping to include log4j-taglib*.jar.

@wilkinsona
Copy link
Member Author

We seem to be missing configuration that overrides the skipping. Tomcat does so for 4 patterns:

log4j-taglib*.jar
log4j-web*.jar
log4javascript*.jar
slf4j-taglib*.jar

In the meantime, a workaround is to use a TomcatContextCustomizer to tune the context's jar scanner:

@Bean
TomcatContextCustomizer log4jTldScanningCustomizer() {
    return (context) -> 
        ((StandardJarScanFilter)context.getJarScanner().getJarScanFilter()).setTldScan("log4j-taglib*.jar");
}

@rahulkhimasia
Copy link

Thanks Andy. The workaround does work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants