Note that there are some explanatory texts on larger screens.

plurals
  1. POThe build file called using <ant> task resets the logging configs of the caller
    primarykey
    data
    text
    <p>Two projects: the product (project-A) and the auto benchmark project for A (project-B).</p> <p>In B's build file, we need to call A's build file to run the build and bundle-with-app-server process like this:</p> <pre><code>&lt;ant antfile="${build-file-A}" inheritall="false" target="all" /&gt; </code></pre> <p>And, in project B, we have a lot of Ant tasks that output messages using java.util.logging (The JDK Logging Framework).</p> <p><strong>The problem is, after that line, all the jdk logger outputs disappear.</strong></p> <p>With debugging, I find that, during the initialzation of project A's build file, a staticly defined thing in project A will run <code>LogManager.readConfiguration(InputStream)</code>, which loads a config file that only contains the logger configuration of a single class.</p> <p>And during <code>readConfiguration</code>, <code>LogManager.reset()</code> will be called; <strong>during <code>reset</code>, each handler of each logger will be removed</strong>. As <code>&lt;ant&gt;</code> will load the target build file to the same process of the caller, all the handlers will be removed.</p> <p>So, except the configurated one, every other class that use jdk logger can't output messages due to lack of output handler.</p> <p><strong>My question is:</strong></p> <p>Is there any way to solve this problem, other than:</p> <ol> <li>use <code>&lt;exec&gt;</code> to run project A's build file;</li> <li>write a task to run <code>readConfiguration()</code> to restore the default JDK logging settings from the default configuration file after the <code>&lt;ant&gt;</code> call.</li> <li>Use ant's own logging framework (Task.log(), etc).</li> </ol> <p>Please note that I can't modify project A to prevent the problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload