This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Allows unit tests to prevent changes to <code>System.err</code> and
<code>System.out</code> by the logging infrastructure.
</api>
<api name="org.netbeans.log.numberOfFiles" category="friend" group="systemproperty" type="export">
Changes the number of files used for log rotation. If started with
<code>-J-Dorg.netbeans.log.numberOfFiles=number</code> then the log files for
<code>number-1</code> previous executions will be preserved. Default and
minimum number is 3.
<api name="org.netbeans.core.startup.ModuleList.firstModuleJarWins" category="friend" group="systemproperty" type="export">
Disables #113341 so that the first version of a module JAR to be encountered is loaded,
even if a later cluster contains a newer version of the same module.
try {
File dir = new File(new File(home, "var"), "log");
dir.mkdirs ();
File f = new File(dir, "messages.log");
File f1 = new File(dir, "messages.log.1");
File f2 = new File(dir, "messages.log.2");
if (f2.exists()) {
int n = Integer.getInteger("org.netbeans.log.numberOfFiles", 3); // NOI18N
f2.delete();
if (n < 3) {
n = 3;
}
if (f1.exists()) {
File[] f = new File[n];
f1.renameTo(f2);
f[0] = new File(dir, "messages.log");
for (int i = 1; i < n; i++) {
if (f.exists()) {
f[i] = new File(dir, "messages.log." + i);
f.renameTo(f1);
FileOutputStream fout = new FileOutputStream(f, false);
if (f[n - 1].exists()) {
f[n - 1].delete();
for (int i = n - 2; i >= 0; i--) {
if (f[i].exists()) {
f[i].renameTo(f[i + 1]);
FileOutputStream fout = new FileOutputStream(f[0], false);
Handler h = new StreamHandler(fout, NbFormatter.FORMATTER);
h.setLevel(Level.ALL);
h.setFormatter(NbFormatter.FORMATTER);