MariusVolkhart commented on a change in pull request #224: URL: https://github.com/apache/poi/pull/224#discussion_r569002478
########## File path: log4j2-console.xml ########## @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> Review comment: > Is there a way to move the two xml-configuration files away from the root-directory? > > For other logging frameworks these are loaded via the classpath, so would go to the "src/resources". Indeed. Our tests use Log4j 2 Core as the logging backend, which also loads configuration from the classpath. So in the case of the POI tests, which use the `log4j2-no-logging.xml` configuration by default, I could place a copy of that config into each test sourceset's `src/resources` directory, and wouldn't need to specify the `log4j.configurationFile` system property. To then get the console behavior, one option is to continue using the `log4j.configurationFile` system property as this code currently does. Another option is to combine the configurations and the developer running the tests comments/uncomments lines of code in the configuration as they need. I don't have a strong opinion on one method or another. > Not sure how this would work in the actual deployment of Apache POI as part of a bigger application, would they also have to store those files in some additional directory and need to set the system-property? I'll answer assuming the application developer is also using Log4j 2 Core as the backend (same as the POI tests in this PR), but I assume similar rules apply if they are using Logback or another logging backend. The existing logging configuration that the developer has will decide how POI log messages are captured. That configuration likely lives at `main/src/resources` and is loaded from the classpath, but it is possible the developer has previously chosen to use the system property, is doing programmatic configuration, etc. Here are some examples of what a developer might indicate in their configuration: 1. Capture all POI logs at the same level as their application logging. Basically, they just say "I want all messages `INFO` and higher, regardless where they come from", and POI messages are included in that. 2. Capture only messages they opt in to. They might say "Only collect messages from package `com.myapplication.*` that are INFO and higher". POI messages are excluded. 3. Capture all messages except POI. They might say "Collect everything _except_ `org.apache.poi.*`." I hope that makes sense. If not, let me know! I haven't started on the changes to the logging documentation for the site, but if seeing those changes as part of the PR would be helpful, I can work on those in the next few days while this sits :) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org